SlideShare a Scribd company logo
1 of 21
Download to read offline
USAGE CONTRACTS* 
KIM MENS 
UNIVERSITÉ CATHOLIQUE DE LOUVAIN (UCL) 
JOINT WORK WITH 
ANGELA LOZANO 
ANDY KELLENS 
SATTOSE 2014 – L’AQUILA – 9-11.07.2014 
* SLIDES LARGELY BASED ON AN EARLIER PRESENTATION MADE BY ANGELA LOZANO
SOME OF MY 
RESEARCH INTERESTS 
Programming languages 
Context-Oriented Programming 
Language interoperability between logic and OO 
(Aspect-oriented programming ✞) 
Tool support for software development, maintenance and evolution 
source code mining 
source-code based recommendation tools 
structural source-code regularities (e.g. usage contracts)
USAGE CONTRACTS : MOTIVATION 
Often you find code comments like 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
/** 
* Deactivates the tool. This method is called whenever the user switches to another tool 
* Use this method to do some clean-up when the tool is switched. 
* Subclassers should always call super.deactivate. 
* An inactive tool should never be deactivated. 
*/ 
public void deactivate() { 
if (isActive()) { 
if (getActiveView() != null) { 
getActiveView().setCursor(new AWTCursor(java.awt.Cursor.DEFAULT_CURSOR)); 
} 
getEventDispatcher().fireToolDeactivatedEvent(); 
} 
}
USAGE CONTRACTS : MOTIVATION 
Often you find code comments like 
! 
! 
! 
! 
We studied JHotDraw for occurrences of “should, may, must, can(not), could, 
ought, have, has, need, require, ….” and found 22 structural regularities like : 
! 
! 
! 
! 
! 
/** 
* Deactivates the tool. This method is called whenever the user switches to another tool 
* Use this method to do some clean-up when the tool is switched. 
* Subclassers should always call super.deactivate. 
* An inactive tool should never be deactivated. 
*/ 
public void deactivate() { 
if (isActive()) { 
if (getActiveView() != null) { 
getActiveView().setCursor(new AWTCursor(java.awt.Cursor.DEFAULT_CURSOR)); 
} 
getEventDispatcher().fireToolDeactivatedEvent(); 
} 
} 
subclassers of this class should call … 
this class should not do a supercall 
… must implement … 
should (not) override 
methods in this class … only be called by … 
this method only be called internally 
be called after …
USAGE CONTRACTS : GOAL 
/** 
* Deactivates the tool. This method is called whenever the user switches to another tool 
* Use this method to do some clean-up when the tool is switched. 
* Subclassers should always call super.deactivate. 
* An inactive tool should never be deactivated. 
*/ 
public void deactivate() { 
if (isActive()) { 
if (getActiveView() != null) { 
getActiveView().setCursor(new AWTCursor(java.awt.Cursor.DEFAULT_CURSOR)); 
} 
getEventDispatcher().fireToolDeactivatedEvent(); 
} 
} 
We want a tool that allows encoding such regularities and offering immediate 
feedback on violations of such structural source-code regularities 
The tool should be proactive (violations reported ‘on the fly’ during coding) 
The tool should be “developer-friendly” (like unit testing but for usage expectations) 
desired regularities expressed in the same programming language 
tight integration with the integrated development environment 
not coercive
METAPHOR 
Provider 
uses 
Consumer 
Usage 
Contract 
describes 
expectations 
of 
should 
comply 
with
EXAMPLE 
copyFrom: anEntity within: aVisitor 
inherits 
from 
copyFrom: anEntity within: aVisitor 
super copyFrom: anEntity within: aVisitor 
... 
All overriders of 
copyFrom:within: 
should start with a 
super call 
describes 
expectations 
of 
should 
comply 
with
EXAMPLE 
copyFrom: anEntity within: aVisitor 
inherits 
from 
copyFrom: anEntity within: aVisitor 
super copyFrom: anEntity within: aVisitor 
... 
All overriders of 
copyFrom:within: 
should start with a 
super call 
describes 
expectations 
of 
should 
comply 
with 
EContract 
classesInFAMIXSourcedEntityHierarchy 
<liableHierarchy:#FAMIXSourcedEntity> 
FAMIXSourcedEntityContract 
classesInFAMIXSourcedEntityHierarchy 
copyFromWithinWithCorrectSuperCall 
Liable 
entity 
copyFromWithinWithCorrectSuperCall 
<selector:#copyFrom:within:> 
contract 
require: 
condition beginsWith: 
(condition doesSuperSend: #copyFrom:within:) 
if: (condition isOverridden) 
Contract 
term 
Contract 
conditions
UCONTRACTS : THE LANGUAGE 
EContract 
Liable classes 
•liableClass: regExp / exceptClass: regExp 
•liableHierarchy: className / exceptHierarchy: className 
•liablePackage: regExp / exceptPackage: regExp 
classesInFAMIXSourcedEntityHierarchy 
<liableHierarchy:#FAMIXSourcedEntity> 
FAMIXSourcedEntityContract 
classesInFAMIXSourcedEntityHierarchy 
copyFromWithinWithCorrectSuperCall 
Liable 
entity 
copyFromWithinWithCorrectSuperCall 
<selector:#copyFrom:within:> 
contract 
require: 
condition beginsWith: 
(condition doesSuperSend: #copyFrom:within:) 
if: (condition isOverridden) 
Contract 
term 
Contract 
conditions 
Liable methods 
•selector: regExp / exceptSelector: regExp 
•protocol: regExp / exceptProtocol: regExp 
•/ exceptClass: className selector: selector 
Contract terms 
•require: condition 
•suggest: condition 
•require: condition if: anotherCondition 
•suggest: condition if: anotherCondition 
Contract conditions 
•assigns: regExp 
•calls: regExp 
•references: regExp 
•returns: expression 
•doesSuperSend: regExp 
•doesSelfSend: regExp 
•inProtocol: regExp 
•isOverridden: selector 
•isOverridden 
•isImplemented: selector 
•custom: visitor 
! 
•and: cond1 with: cond2 
•or: cond1 with: cond2 
•not: cond 
! 
•beginsWith: cond 
•endsWith: cond 
•does: cond1 after: cond2 
•does: cond1 before: cond2
UCONTRACTS : THE TOOL
VALIDATION ON AN 
INDUSTRIAL CASE 
• An interactive web application for event & resource planning 
• developed in Pharo Smalltalk 
• uses the Seaside web development framework. 
• Medium-sized 
• Packages: 45 
• Classes: 827 
• Methods: 11777 
• LOCs: 94151
INDUSTRIAL VALIDATION : 
SET-UP OF THE EXPERIMENT 
• Qualitative assessment 
• Ideally we would have liked the tool to be used directly by the 
developers, but instead we had to perform an offline experiment. 
• Together with the developers, during 2 days we defined 13 
contracts documenting important regularities in their framework 
• We checked all contracts in December and reported all contract 
breaches to the developers 
• 3 months later, we reverified compliance of the code against the 
same contracts
INDUSTRIAL VALIDATION : 
ABOUT THE CONTRACTS 
• contracts related to the model of the web application 
• for 3/5 of them violations were found 
• 214 liable classes, 88 violations 
• contracts related to the classes dealing with persistency 
• for 2/2 of them violations where found 
• 75 liable classes, 2 violations found 
• contracts about how the UI is constructed with the Seaside framework 
• for 4/6 of them violations where found 
• 598 liable classes, 8 violations found
INDUSTRIAL VALIDATION : 
EXAMPLE OF A CONTRACT 
Private methods should not be called directly 
liable classes 
contract
INDUSTRIAL VALIDATION : 
EXAMPLE OF A CONTRACT 
In domain classes, state changes must mark model 
objects as dirty so that they can be re-rendered 
liable classes 
contract
INDUSTRIAL VALIDATION : 
EXAMPLE OF A CONTRACT 
Overridden initialisation methods should start with a 
super call (and be put in an appropriate protocol) 
liable classes 
contract
INDUSTRIAL VALIDATION : 
EXAMPLE OF A CONTRACT 
Certain messages need to be sent at the end of a 
method cascade liable classes 
contract
INDUSTRIAL VALIDATION : 
EXAMPLE OF A CONTRACT 
Certain messages need to be sent at the end of a 
method cascade liable classes 
contract 
contract 
WithInCascadeVisitor extends CustomConditionVisitor
INDUSTRIAL VALIDATION : 
RESULTS 
Contract Liable Methods Exceptions 
Errors 
December 
Errors 
March 
Private methods 
should not be 
called directly 
7410 0 3 2 
Marking dirty 
objects 333 5 7 2 
Initialisation 
methods should 
44 0 1 0 
start with super 
Call ordering 
within method 
cascade 
531 0 0 0
UCONTRACTS : CONCLUSION 
• uContracts offer a simple unit-testing like way for letting programmers 
document and check conformance to structural source-code regularities 
• using a “contract” metaphor 
• focus on immediate feedback during development 
• embedded DSL close to the programming language 
• tight integration with the IDE 
• Publication pending: A. Lozano, K. Mens, and A. Kellens, “Usage 
contracts: offering immediate feed- back on violations of structural 
source-code regularities”. (submitted to SciCo)
FUTURE WORK 
• More validation 
• Improve / extend the DSL 
• Port to most recent version of Pharo 
• uContracts for other languages (e.g., Ruby)

More Related Content

What's hot

IoT 개발자를 위한 Embedded C에서 Test Coverage를 추출해보자
IoT 개발자를 위한 Embedded C에서 Test Coverage를 추출해보자IoT 개발자를 위한 Embedded C에서 Test Coverage를 추출해보자
IoT 개발자를 위한 Embedded C에서 Test Coverage를 추출해보자Taeyeop Kim
 
Software testing ... who’s responsible is it?
Software testing ... who’s responsible is it?Software testing ... who’s responsible is it?
Software testing ... who’s responsible is it?Manjula03809891
 
iOS Unit Testing
iOS Unit TestingiOS Unit Testing
iOS Unit Testingsgleadow
 
Errors detected in the Visual C++ 2012 libraries
Errors detected in the Visual C++ 2012 librariesErrors detected in the Visual C++ 2012 libraries
Errors detected in the Visual C++ 2012 librariesPVS-Studio
 
Performance Testing | Instamojo
Performance Testing | InstamojoPerformance Testing | Instamojo
Performance Testing | InstamojoMohit Shukla
 
Hyper-pragmatic Pure FP testing with distage-testkit
Hyper-pragmatic Pure FP testing with distage-testkitHyper-pragmatic Pure FP testing with distage-testkit
Hyper-pragmatic Pure FP testing with distage-testkit7mind
 
ScalaUA - distage: Staged Dependency Injection
ScalaUA - distage: Staged Dependency InjectionScalaUA - distage: Staged Dependency Injection
ScalaUA - distage: Staged Dependency Injection7mind
 
Checking Clang 11 with PVS-Studio
Checking Clang 11 with PVS-StudioChecking Clang 11 with PVS-Studio
Checking Clang 11 with PVS-StudioAndrey Karpov
 
Write testable code in java, best practices
Write testable code in java, best practicesWrite testable code in java, best practices
Write testable code in java, best practicesMarian Wamsiedel
 
PVS-Studio advertisement - static analysis of C/C++ code
PVS-Studio advertisement - static analysis of C/C++ codePVS-Studio advertisement - static analysis of C/C++ code
PVS-Studio advertisement - static analysis of C/C++ codeAndrey Karpov
 
Date Processing Attracts Bugs or 77 Defects in Qt 6
Date Processing Attracts Bugs or 77 Defects in Qt 6Date Processing Attracts Bugs or 77 Defects in Qt 6
Date Processing Attracts Bugs or 77 Defects in Qt 6Andrey Karpov
 
TDD and the Legacy Code Black Hole
TDD and the Legacy Code Black HoleTDD and the Legacy Code Black Hole
TDD and the Legacy Code Black HoleNoam Kfir
 
How penetration testing techniques can help you improve your qa skills
How penetration testing techniques can help you improve your qa skillsHow penetration testing techniques can help you improve your qa skills
How penetration testing techniques can help you improve your qa skillsMarian Marinov
 
Looking for Bugs in MonoDevelop
Looking for Bugs in MonoDevelopLooking for Bugs in MonoDevelop
Looking for Bugs in MonoDevelopPVS-Studio
 
Writing testable Android apps
Writing testable Android appsWriting testable Android apps
Writing testable Android appsTomáš Kypta
 
A Long-Awaited Check of Unreal Engine 4
A Long-Awaited Check of Unreal Engine 4A Long-Awaited Check of Unreal Engine 4
A Long-Awaited Check of Unreal Engine 4Andrey Karpov
 
Izumi 1.0: Your Next Scala Stack
Izumi 1.0: Your Next Scala StackIzumi 1.0: Your Next Scala Stack
Izumi 1.0: Your Next Scala Stack7mind
 

What's hot (18)

IoT 개발자를 위한 Embedded C에서 Test Coverage를 추출해보자
IoT 개발자를 위한 Embedded C에서 Test Coverage를 추출해보자IoT 개발자를 위한 Embedded C에서 Test Coverage를 추출해보자
IoT 개발자를 위한 Embedded C에서 Test Coverage를 추출해보자
 
Software testing ... who’s responsible is it?
Software testing ... who’s responsible is it?Software testing ... who’s responsible is it?
Software testing ... who’s responsible is it?
 
iOS Unit Testing
iOS Unit TestingiOS Unit Testing
iOS Unit Testing
 
Errors detected in the Visual C++ 2012 libraries
Errors detected in the Visual C++ 2012 librariesErrors detected in the Visual C++ 2012 libraries
Errors detected in the Visual C++ 2012 libraries
 
Performance Testing | Instamojo
Performance Testing | InstamojoPerformance Testing | Instamojo
Performance Testing | Instamojo
 
Hyper-pragmatic Pure FP testing with distage-testkit
Hyper-pragmatic Pure FP testing with distage-testkitHyper-pragmatic Pure FP testing with distage-testkit
Hyper-pragmatic Pure FP testing with distage-testkit
 
ScalaUA - distage: Staged Dependency Injection
ScalaUA - distage: Staged Dependency InjectionScalaUA - distage: Staged Dependency Injection
ScalaUA - distage: Staged Dependency Injection
 
Checking Clang 11 with PVS-Studio
Checking Clang 11 with PVS-StudioChecking Clang 11 with PVS-Studio
Checking Clang 11 with PVS-Studio
 
Write testable code in java, best practices
Write testable code in java, best practicesWrite testable code in java, best practices
Write testable code in java, best practices
 
PVS-Studio advertisement - static analysis of C/C++ code
PVS-Studio advertisement - static analysis of C/C++ codePVS-Studio advertisement - static analysis of C/C++ code
PVS-Studio advertisement - static analysis of C/C++ code
 
Date Processing Attracts Bugs or 77 Defects in Qt 6
Date Processing Attracts Bugs or 77 Defects in Qt 6Date Processing Attracts Bugs or 77 Defects in Qt 6
Date Processing Attracts Bugs or 77 Defects in Qt 6
 
Write readable tests
Write readable testsWrite readable tests
Write readable tests
 
TDD and the Legacy Code Black Hole
TDD and the Legacy Code Black HoleTDD and the Legacy Code Black Hole
TDD and the Legacy Code Black Hole
 
How penetration testing techniques can help you improve your qa skills
How penetration testing techniques can help you improve your qa skillsHow penetration testing techniques can help you improve your qa skills
How penetration testing techniques can help you improve your qa skills
 
Looking for Bugs in MonoDevelop
Looking for Bugs in MonoDevelopLooking for Bugs in MonoDevelop
Looking for Bugs in MonoDevelop
 
Writing testable Android apps
Writing testable Android appsWriting testable Android apps
Writing testable Android apps
 
A Long-Awaited Check of Unreal Engine 4
A Long-Awaited Check of Unreal Engine 4A Long-Awaited Check of Unreal Engine 4
A Long-Awaited Check of Unreal Engine 4
 
Izumi 1.0: Your Next Scala Stack
Izumi 1.0: Your Next Scala StackIzumi 1.0: Your Next Scala Stack
Izumi 1.0: Your Next Scala Stack
 

Viewers also liked

The Responsive Bank. Feature article in Q factor Oct 2014
The Responsive Bank. Feature article in Q factor Oct 2014The Responsive Bank. Feature article in Q factor Oct 2014
The Responsive Bank. Feature article in Q factor Oct 2014Simon Terry
 
Metric edge final 1
Metric edge final 1Metric edge final 1
Metric edge final 1Vyom Labs
 
Freshmail - Pomysly na efektywne mailingi
Freshmail - Pomysly na efektywne mailingiFreshmail - Pomysly na efektywne mailingi
Freshmail - Pomysly na efektywne mailingiTravelCamp
 
A Strategic Control Module for a Corporate Model of British Telecom
A Strategic Control Module for a Corporate Model of British TelecomA Strategic Control Module for a Corporate Model of British Telecom
A Strategic Control Module for a Corporate Model of British TelecomDr David Probert
 

Viewers also liked (8)

Ppp 206
Ppp 206Ppp 206
Ppp 206
 
Content ux processes_idw_2014_final
Content ux processes_idw_2014_finalContent ux processes_idw_2014_final
Content ux processes_idw_2014_final
 
The Responsive Bank. Feature article in Q factor Oct 2014
The Responsive Bank. Feature article in Q factor Oct 2014The Responsive Bank. Feature article in Q factor Oct 2014
The Responsive Bank. Feature article in Q factor Oct 2014
 
Metric edge final 1
Metric edge final 1Metric edge final 1
Metric edge final 1
 
Freshmail - Pomysly na efektywne mailingi
Freshmail - Pomysly na efektywne mailingiFreshmail - Pomysly na efektywne mailingi
Freshmail - Pomysly na efektywne mailingi
 
University of madras notice
University of madras noticeUniversity of madras notice
University of madras notice
 
Designer wanted
Designer wantedDesigner wanted
Designer wanted
 
A Strategic Control Module for a Corporate Model of British Telecom
A Strategic Control Module for a Corporate Model of British TelecomA Strategic Control Module for a Corporate Model of British Telecom
A Strategic Control Module for a Corporate Model of British Telecom
 

Similar to Usage contracts (presented at SATToSE 2014 in L'Aquila, Italy)

Usage contracts in a nutshell
Usage contracts in a nutshellUsage contracts in a nutshell
Usage contracts in a nutshellkim.mens
 
UContracts a DSL to document and validate structural requirements of frameworks
UContracts a DSL to document and validate structural requirements of frameworksUContracts a DSL to document and validate structural requirements of frameworks
UContracts a DSL to document and validate structural requirements of frameworksAngela Lozano
 
Framework Agnostic Discovery
Framework Agnostic DiscoveryFramework Agnostic Discovery
Framework Agnostic DiscoveryKubeAcademy
 
Intro to Automation Using Perfecto's CQ Lab
Intro to Automation Using Perfecto's CQ LabIntro to Automation Using Perfecto's CQ Lab
Intro to Automation Using Perfecto's CQ LabLizzy Guido (she/her)
 
Leveraging Dependency Injection(DI) in Universal Applications - Tamir Dresher
Leveraging Dependency Injection(DI) in Universal Applications -  Tamir DresherLeveraging Dependency Injection(DI) in Universal Applications -  Tamir Dresher
Leveraging Dependency Injection(DI) in Universal Applications - Tamir DresherTamir Dresher
 
Rock Your Code With Code Contracts -2013
Rock Your Code With Code Contracts -2013Rock Your Code With Code Contracts -2013
Rock Your Code With Code Contracts -2013David McCarter
 
TDD for Microservices
TDD for MicroservicesTDD for Microservices
TDD for MicroservicesVMware Tanzu
 
Fragility in evolving software
Fragility in evolving softwareFragility in evolving software
Fragility in evolving softwarekim.mens
 
Clean Code Part II - Dependency Injection at SoCal Code Camp
Clean Code Part II - Dependency Injection at SoCal Code CampClean Code Part II - Dependency Injection at SoCal Code Camp
Clean Code Part II - Dependency Injection at SoCal Code CampTheo Jungeblut
 
Cut your Dependencies with Dependency Injection for East Bay.NET User Group
Cut your Dependencies with Dependency Injection for East Bay.NET User Group Cut your Dependencies with Dependency Injection for East Bay.NET User Group
Cut your Dependencies with Dependency Injection for East Bay.NET User Group Theo Jungeblut
 
DDD, CQRS and testing with ASP.Net MVC
DDD, CQRS and testing with ASP.Net MVCDDD, CQRS and testing with ASP.Net MVC
DDD, CQRS and testing with ASP.Net MVCAndy Butland
 
Automatically Managing Service Dependencies in an OSGi Environment - Marcel O...
Automatically Managing Service Dependencies in an OSGi Environment - Marcel O...Automatically Managing Service Dependencies in an OSGi Environment - Marcel O...
Automatically Managing Service Dependencies in an OSGi Environment - Marcel O...mfrancis
 
Workshop: .NET Code Contracts
Workshop: .NET Code ContractsWorkshop: .NET Code Contracts
Workshop: .NET Code ContractsRainer Stropek
 
Multilanguage Pipelines with Jenkins, Docker and Kubernetes (Commit Conf 2018)
Multilanguage Pipelines with Jenkins, Docker and Kubernetes (Commit Conf 2018)Multilanguage Pipelines with Jenkins, Docker and Kubernetes (Commit Conf 2018)
Multilanguage Pipelines with Jenkins, Docker and Kubernetes (Commit Conf 2018)Jorge Hidalgo
 
Increasing productivity with continuous delivery
Increasing productivity with continuous deliveryIncreasing productivity with continuous delivery
Increasing productivity with continuous deliveryAndré Pitombeira
 
Preparing for DevOps
Preparing for DevOpsPreparing for DevOps
Preparing for DevOpsEklove Mohan
 
Slides1 - testing
Slides1 - testingSlides1 - testing
Slides1 - testingJyothi Vbs
 
Centralize and Simplify Secrets Management for Red Hat OpenShift Container En...
Centralize and Simplify Secrets Management for Red Hat OpenShift Container En...Centralize and Simplify Secrets Management for Red Hat OpenShift Container En...
Centralize and Simplify Secrets Management for Red Hat OpenShift Container En...DevOps.com
 
Cut your Dependencies with Dependency Injection - .NET User Group Osnabrueck
Cut your Dependencies with Dependency Injection - .NET User Group OsnabrueckCut your Dependencies with Dependency Injection - .NET User Group Osnabrueck
Cut your Dependencies with Dependency Injection - .NET User Group OsnabrueckTheo Jungeblut
 

Similar to Usage contracts (presented at SATToSE 2014 in L'Aquila, Italy) (20)

Usage contracts in a nutshell
Usage contracts in a nutshellUsage contracts in a nutshell
Usage contracts in a nutshell
 
Dependency Injection
Dependency InjectionDependency Injection
Dependency Injection
 
UContracts a DSL to document and validate structural requirements of frameworks
UContracts a DSL to document and validate structural requirements of frameworksUContracts a DSL to document and validate structural requirements of frameworks
UContracts a DSL to document and validate structural requirements of frameworks
 
Framework Agnostic Discovery
Framework Agnostic DiscoveryFramework Agnostic Discovery
Framework Agnostic Discovery
 
Intro to Automation Using Perfecto's CQ Lab
Intro to Automation Using Perfecto's CQ LabIntro to Automation Using Perfecto's CQ Lab
Intro to Automation Using Perfecto's CQ Lab
 
Leveraging Dependency Injection(DI) in Universal Applications - Tamir Dresher
Leveraging Dependency Injection(DI) in Universal Applications -  Tamir DresherLeveraging Dependency Injection(DI) in Universal Applications -  Tamir Dresher
Leveraging Dependency Injection(DI) in Universal Applications - Tamir Dresher
 
Rock Your Code With Code Contracts -2013
Rock Your Code With Code Contracts -2013Rock Your Code With Code Contracts -2013
Rock Your Code With Code Contracts -2013
 
TDD for Microservices
TDD for MicroservicesTDD for Microservices
TDD for Microservices
 
Fragility in evolving software
Fragility in evolving softwareFragility in evolving software
Fragility in evolving software
 
Clean Code Part II - Dependency Injection at SoCal Code Camp
Clean Code Part II - Dependency Injection at SoCal Code CampClean Code Part II - Dependency Injection at SoCal Code Camp
Clean Code Part II - Dependency Injection at SoCal Code Camp
 
Cut your Dependencies with Dependency Injection for East Bay.NET User Group
Cut your Dependencies with Dependency Injection for East Bay.NET User Group Cut your Dependencies with Dependency Injection for East Bay.NET User Group
Cut your Dependencies with Dependency Injection for East Bay.NET User Group
 
DDD, CQRS and testing with ASP.Net MVC
DDD, CQRS and testing with ASP.Net MVCDDD, CQRS and testing with ASP.Net MVC
DDD, CQRS and testing with ASP.Net MVC
 
Automatically Managing Service Dependencies in an OSGi Environment - Marcel O...
Automatically Managing Service Dependencies in an OSGi Environment - Marcel O...Automatically Managing Service Dependencies in an OSGi Environment - Marcel O...
Automatically Managing Service Dependencies in an OSGi Environment - Marcel O...
 
Workshop: .NET Code Contracts
Workshop: .NET Code ContractsWorkshop: .NET Code Contracts
Workshop: .NET Code Contracts
 
Multilanguage Pipelines with Jenkins, Docker and Kubernetes (Commit Conf 2018)
Multilanguage Pipelines with Jenkins, Docker and Kubernetes (Commit Conf 2018)Multilanguage Pipelines with Jenkins, Docker and Kubernetes (Commit Conf 2018)
Multilanguage Pipelines with Jenkins, Docker and Kubernetes (Commit Conf 2018)
 
Increasing productivity with continuous delivery
Increasing productivity with continuous deliveryIncreasing productivity with continuous delivery
Increasing productivity with continuous delivery
 
Preparing for DevOps
Preparing for DevOpsPreparing for DevOps
Preparing for DevOps
 
Slides1 - testing
Slides1 - testingSlides1 - testing
Slides1 - testing
 
Centralize and Simplify Secrets Management for Red Hat OpenShift Container En...
Centralize and Simplify Secrets Management for Red Hat OpenShift Container En...Centralize and Simplify Secrets Management for Red Hat OpenShift Container En...
Centralize and Simplify Secrets Management for Red Hat OpenShift Container En...
 
Cut your Dependencies with Dependency Injection - .NET User Group Osnabrueck
Cut your Dependencies with Dependency Injection - .NET User Group OsnabrueckCut your Dependencies with Dependency Injection - .NET User Group Osnabrueck
Cut your Dependencies with Dependency Injection - .NET User Group Osnabrueck
 

More from kim.mens

Software Maintenance and Evolution
Software Maintenance and EvolutionSoftware Maintenance and Evolution
Software Maintenance and Evolutionkim.mens
 
Context-Oriented Programming
Context-Oriented ProgrammingContext-Oriented Programming
Context-Oriented Programmingkim.mens
 
Software Reuse and Object-Oriented Programming
Software Reuse and Object-Oriented ProgrammingSoftware Reuse and Object-Oriented Programming
Software Reuse and Object-Oriented Programmingkim.mens
 
Bad Code Smells
Bad Code SmellsBad Code Smells
Bad Code Smellskim.mens
 
Object-Oriented Design Heuristics
Object-Oriented Design HeuristicsObject-Oriented Design Heuristics
Object-Oriented Design Heuristicskim.mens
 
Software Patterns
Software PatternsSoftware Patterns
Software Patternskim.mens
 
Code Refactoring
Code RefactoringCode Refactoring
Code Refactoringkim.mens
 
Domain Modelling
Domain ModellingDomain Modelling
Domain Modellingkim.mens
 
Object-Oriented Application Frameworks
Object-Oriented Application FrameworksObject-Oriented Application Frameworks
Object-Oriented Application Frameworkskim.mens
 
Towards a Context-Oriented Software Implementation Framework
Towards a Context-Oriented Software Implementation FrameworkTowards a Context-Oriented Software Implementation Framework
Towards a Context-Oriented Software Implementation Frameworkkim.mens
 
Towards a Taxonomy of Context-Aware Software Variabilty Approaches
Towards a Taxonomy of Context-Aware Software Variabilty ApproachesTowards a Taxonomy of Context-Aware Software Variabilty Approaches
Towards a Taxonomy of Context-Aware Software Variabilty Approacheskim.mens
 
Breaking the Walls: A Unified Vision on Context-Oriented Software Engineering
Breaking the Walls: A Unified Vision on Context-Oriented Software EngineeringBreaking the Walls: A Unified Vision on Context-Oriented Software Engineering
Breaking the Walls: A Unified Vision on Context-Oriented Software Engineeringkim.mens
 
Context-oriented programming
Context-oriented programmingContext-oriented programming
Context-oriented programmingkim.mens
 
Basics of reflection
Basics of reflectionBasics of reflection
Basics of reflectionkim.mens
 
Advanced Reflection in Java
Advanced Reflection in JavaAdvanced Reflection in Java
Advanced Reflection in Javakim.mens
 
Basics of reflection in java
Basics of reflection in javaBasics of reflection in java
Basics of reflection in javakim.mens
 
Reflection in Ruby
Reflection in RubyReflection in Ruby
Reflection in Rubykim.mens
 
Introduction to Ruby
Introduction to RubyIntroduction to Ruby
Introduction to Rubykim.mens
 
Introduction to Smalltalk
Introduction to SmalltalkIntroduction to Smalltalk
Introduction to Smalltalkkim.mens
 
A gentle introduction to reflection
A gentle introduction to reflectionA gentle introduction to reflection
A gentle introduction to reflectionkim.mens
 

More from kim.mens (20)

Software Maintenance and Evolution
Software Maintenance and EvolutionSoftware Maintenance and Evolution
Software Maintenance and Evolution
 
Context-Oriented Programming
Context-Oriented ProgrammingContext-Oriented Programming
Context-Oriented Programming
 
Software Reuse and Object-Oriented Programming
Software Reuse and Object-Oriented ProgrammingSoftware Reuse and Object-Oriented Programming
Software Reuse and Object-Oriented Programming
 
Bad Code Smells
Bad Code SmellsBad Code Smells
Bad Code Smells
 
Object-Oriented Design Heuristics
Object-Oriented Design HeuristicsObject-Oriented Design Heuristics
Object-Oriented Design Heuristics
 
Software Patterns
Software PatternsSoftware Patterns
Software Patterns
 
Code Refactoring
Code RefactoringCode Refactoring
Code Refactoring
 
Domain Modelling
Domain ModellingDomain Modelling
Domain Modelling
 
Object-Oriented Application Frameworks
Object-Oriented Application FrameworksObject-Oriented Application Frameworks
Object-Oriented Application Frameworks
 
Towards a Context-Oriented Software Implementation Framework
Towards a Context-Oriented Software Implementation FrameworkTowards a Context-Oriented Software Implementation Framework
Towards a Context-Oriented Software Implementation Framework
 
Towards a Taxonomy of Context-Aware Software Variabilty Approaches
Towards a Taxonomy of Context-Aware Software Variabilty ApproachesTowards a Taxonomy of Context-Aware Software Variabilty Approaches
Towards a Taxonomy of Context-Aware Software Variabilty Approaches
 
Breaking the Walls: A Unified Vision on Context-Oriented Software Engineering
Breaking the Walls: A Unified Vision on Context-Oriented Software EngineeringBreaking the Walls: A Unified Vision on Context-Oriented Software Engineering
Breaking the Walls: A Unified Vision on Context-Oriented Software Engineering
 
Context-oriented programming
Context-oriented programmingContext-oriented programming
Context-oriented programming
 
Basics of reflection
Basics of reflectionBasics of reflection
Basics of reflection
 
Advanced Reflection in Java
Advanced Reflection in JavaAdvanced Reflection in Java
Advanced Reflection in Java
 
Basics of reflection in java
Basics of reflection in javaBasics of reflection in java
Basics of reflection in java
 
Reflection in Ruby
Reflection in RubyReflection in Ruby
Reflection in Ruby
 
Introduction to Ruby
Introduction to RubyIntroduction to Ruby
Introduction to Ruby
 
Introduction to Smalltalk
Introduction to SmalltalkIntroduction to Smalltalk
Introduction to Smalltalk
 
A gentle introduction to reflection
A gentle introduction to reflectionA gentle introduction to reflection
A gentle introduction to reflection
 

Recently uploaded

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 

Recently uploaded (20)

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 

Usage contracts (presented at SATToSE 2014 in L'Aquila, Italy)

  • 1. USAGE CONTRACTS* KIM MENS UNIVERSITÉ CATHOLIQUE DE LOUVAIN (UCL) JOINT WORK WITH ANGELA LOZANO ANDY KELLENS SATTOSE 2014 – L’AQUILA – 9-11.07.2014 * SLIDES LARGELY BASED ON AN EARLIER PRESENTATION MADE BY ANGELA LOZANO
  • 2. SOME OF MY RESEARCH INTERESTS Programming languages Context-Oriented Programming Language interoperability between logic and OO (Aspect-oriented programming ✞) Tool support for software development, maintenance and evolution source code mining source-code based recommendation tools structural source-code regularities (e.g. usage contracts)
  • 3. USAGE CONTRACTS : MOTIVATION Often you find code comments like ! ! ! ! ! ! ! ! ! ! /** * Deactivates the tool. This method is called whenever the user switches to another tool * Use this method to do some clean-up when the tool is switched. * Subclassers should always call super.deactivate. * An inactive tool should never be deactivated. */ public void deactivate() { if (isActive()) { if (getActiveView() != null) { getActiveView().setCursor(new AWTCursor(java.awt.Cursor.DEFAULT_CURSOR)); } getEventDispatcher().fireToolDeactivatedEvent(); } }
  • 4. USAGE CONTRACTS : MOTIVATION Often you find code comments like ! ! ! ! We studied JHotDraw for occurrences of “should, may, must, can(not), could, ought, have, has, need, require, ….” and found 22 structural regularities like : ! ! ! ! ! /** * Deactivates the tool. This method is called whenever the user switches to another tool * Use this method to do some clean-up when the tool is switched. * Subclassers should always call super.deactivate. * An inactive tool should never be deactivated. */ public void deactivate() { if (isActive()) { if (getActiveView() != null) { getActiveView().setCursor(new AWTCursor(java.awt.Cursor.DEFAULT_CURSOR)); } getEventDispatcher().fireToolDeactivatedEvent(); } } subclassers of this class should call … this class should not do a supercall … must implement … should (not) override methods in this class … only be called by … this method only be called internally be called after …
  • 5. USAGE CONTRACTS : GOAL /** * Deactivates the tool. This method is called whenever the user switches to another tool * Use this method to do some clean-up when the tool is switched. * Subclassers should always call super.deactivate. * An inactive tool should never be deactivated. */ public void deactivate() { if (isActive()) { if (getActiveView() != null) { getActiveView().setCursor(new AWTCursor(java.awt.Cursor.DEFAULT_CURSOR)); } getEventDispatcher().fireToolDeactivatedEvent(); } } We want a tool that allows encoding such regularities and offering immediate feedback on violations of such structural source-code regularities The tool should be proactive (violations reported ‘on the fly’ during coding) The tool should be “developer-friendly” (like unit testing but for usage expectations) desired regularities expressed in the same programming language tight integration with the integrated development environment not coercive
  • 6. METAPHOR Provider uses Consumer Usage Contract describes expectations of should comply with
  • 7. EXAMPLE copyFrom: anEntity within: aVisitor inherits from copyFrom: anEntity within: aVisitor super copyFrom: anEntity within: aVisitor ... All overriders of copyFrom:within: should start with a super call describes expectations of should comply with
  • 8. EXAMPLE copyFrom: anEntity within: aVisitor inherits from copyFrom: anEntity within: aVisitor super copyFrom: anEntity within: aVisitor ... All overriders of copyFrom:within: should start with a super call describes expectations of should comply with EContract classesInFAMIXSourcedEntityHierarchy <liableHierarchy:#FAMIXSourcedEntity> FAMIXSourcedEntityContract classesInFAMIXSourcedEntityHierarchy copyFromWithinWithCorrectSuperCall Liable entity copyFromWithinWithCorrectSuperCall <selector:#copyFrom:within:> contract require: condition beginsWith: (condition doesSuperSend: #copyFrom:within:) if: (condition isOverridden) Contract term Contract conditions
  • 9. UCONTRACTS : THE LANGUAGE EContract Liable classes •liableClass: regExp / exceptClass: regExp •liableHierarchy: className / exceptHierarchy: className •liablePackage: regExp / exceptPackage: regExp classesInFAMIXSourcedEntityHierarchy <liableHierarchy:#FAMIXSourcedEntity> FAMIXSourcedEntityContract classesInFAMIXSourcedEntityHierarchy copyFromWithinWithCorrectSuperCall Liable entity copyFromWithinWithCorrectSuperCall <selector:#copyFrom:within:> contract require: condition beginsWith: (condition doesSuperSend: #copyFrom:within:) if: (condition isOverridden) Contract term Contract conditions Liable methods •selector: regExp / exceptSelector: regExp •protocol: regExp / exceptProtocol: regExp •/ exceptClass: className selector: selector Contract terms •require: condition •suggest: condition •require: condition if: anotherCondition •suggest: condition if: anotherCondition Contract conditions •assigns: regExp •calls: regExp •references: regExp •returns: expression •doesSuperSend: regExp •doesSelfSend: regExp •inProtocol: regExp •isOverridden: selector •isOverridden •isImplemented: selector •custom: visitor ! •and: cond1 with: cond2 •or: cond1 with: cond2 •not: cond ! •beginsWith: cond •endsWith: cond •does: cond1 after: cond2 •does: cond1 before: cond2
  • 11. VALIDATION ON AN INDUSTRIAL CASE • An interactive web application for event & resource planning • developed in Pharo Smalltalk • uses the Seaside web development framework. • Medium-sized • Packages: 45 • Classes: 827 • Methods: 11777 • LOCs: 94151
  • 12. INDUSTRIAL VALIDATION : SET-UP OF THE EXPERIMENT • Qualitative assessment • Ideally we would have liked the tool to be used directly by the developers, but instead we had to perform an offline experiment. • Together with the developers, during 2 days we defined 13 contracts documenting important regularities in their framework • We checked all contracts in December and reported all contract breaches to the developers • 3 months later, we reverified compliance of the code against the same contracts
  • 13. INDUSTRIAL VALIDATION : ABOUT THE CONTRACTS • contracts related to the model of the web application • for 3/5 of them violations were found • 214 liable classes, 88 violations • contracts related to the classes dealing with persistency • for 2/2 of them violations where found • 75 liable classes, 2 violations found • contracts about how the UI is constructed with the Seaside framework • for 4/6 of them violations where found • 598 liable classes, 8 violations found
  • 14. INDUSTRIAL VALIDATION : EXAMPLE OF A CONTRACT Private methods should not be called directly liable classes contract
  • 15. INDUSTRIAL VALIDATION : EXAMPLE OF A CONTRACT In domain classes, state changes must mark model objects as dirty so that they can be re-rendered liable classes contract
  • 16. INDUSTRIAL VALIDATION : EXAMPLE OF A CONTRACT Overridden initialisation methods should start with a super call (and be put in an appropriate protocol) liable classes contract
  • 17. INDUSTRIAL VALIDATION : EXAMPLE OF A CONTRACT Certain messages need to be sent at the end of a method cascade liable classes contract
  • 18. INDUSTRIAL VALIDATION : EXAMPLE OF A CONTRACT Certain messages need to be sent at the end of a method cascade liable classes contract contract WithInCascadeVisitor extends CustomConditionVisitor
  • 19. INDUSTRIAL VALIDATION : RESULTS Contract Liable Methods Exceptions Errors December Errors March Private methods should not be called directly 7410 0 3 2 Marking dirty objects 333 5 7 2 Initialisation methods should 44 0 1 0 start with super Call ordering within method cascade 531 0 0 0
  • 20. UCONTRACTS : CONCLUSION • uContracts offer a simple unit-testing like way for letting programmers document and check conformance to structural source-code regularities • using a “contract” metaphor • focus on immediate feedback during development • embedded DSL close to the programming language • tight integration with the IDE • Publication pending: A. Lozano, K. Mens, and A. Kellens, “Usage contracts: offering immediate feed- back on violations of structural source-code regularities”. (submitted to SciCo)
  • 21. FUTURE WORK • More validation • Improve / extend the DSL • Port to most recent version of Pharo • uContracts for other languages (e.g., Ruby)