SlideShare ist ein Scribd-Unternehmen logo
1 von 21
Downloaden Sie, um offline zu lesen
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)

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Andere mochten auch

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
 

Andere mochten auch (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
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
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 

Kürzlich hochgeladen (20)

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
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
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 

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)