1 Reuse Contracts Patrick Steyaert Programming Technology Lab Vrije Universiteit Brussel WWW:

Slides:



Advertisements
Similar presentations
Design Patterns.
Advertisements

1 A Graph Rewriting Formalism for Object-Oriented Software Evolution Tom Mens FWO Postdoctoral Fellow Programming Technology Lab Vrije.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 12Slide 1 Software Design l Objectives To explain how a software design may be represented.
 Recent researches show that predicative programming can be used to specify OO concepts including classes, objects, interfaces, methods, single and multiple.
Observer Method 1. References Gamma Erich, Helm Richard, “Design Patterns: Elements of Reusable Object- Oriented Software” 2.
CSE3308/CSC Software Engineering: Analysis and DesignLecture 5B.1 Software Engineering: Analysis and Design - CSE3308 Patterns CSE3308/CSC3080/DMS/2000/12.
Chapter 7 Testing Class Hierarchies. SWE 415 Chapter 7 2 Reading Assignment  John McGregor and David A. Sykes, A Practical Guide to Testing Object-Oriented.
7M701 1 Software Engineering Object-oriented Design Sommerville, Ian (2001) Software Engineering, 6 th edition: Chapter 12 )
Observer Pattern Fall 2005 OOPD John Anthony. What is a Pattern? “Each pattern describes a problem which occurs over and over again in our environment,
CSE Software Engineering: Analysis and Design, 2002Lecture 7B.1 Software Engineering: Analysis and Design - CSE3308 Patterns CSE3308/DMS/2002/15.
1 Software Testing and Quality Assurance Lecture 28 – Testing Class Hierarchies.
Aalborg Media Lab 23-Jun-15 Inheritance Lecture 10 Chapter 8.
Copyright © Active Frameworks Inc. - All Rights Reserved.More On Behavioral Patterns - Page L9-1 PS95&96-MEF-L16-1 Dr. M.E. Fayad Creationa l.
Software AutomationMarch Managing the Evolution of Reusable Assets Theo D’Hondt Patrick Steyaert Programming Technology Lab Vrije Universiteit Brussel.
Modified from Sommerville’s originalsSoftware Engineering, 7th edition. Chapter 8 Slide 1 System models.
Vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie Themes and Variations abstraction -- the object metaphor modeling -- understanding.
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
1 Object-Oriented Software Engineering CIS 375 Bruce R. Maxim UM-Dearborn.
© SERG Software Design (OOD Patterns) Object-Oriented Design Patterns Topics in Object-Oriented Design Patterns Compliments of Spiros Mancoridis Material.
Design Patterns.
Object-oriented Software Engineering with Reuse Contracts Koen De Hondt, Carine Lucas, Kim Mens, Tom Mens, Patrick Steyaert, Roel Wuyts Programming Technology.
Ontology Development Kenneth Baclawski Northeastern University Harvard Medical School.
1 CS 456 Software Engineering. 2 Contents 3 Chapter 1: Introduction.
Chapter 7 – Design and Implementation Lecture 2 1Chapter 7 Design and implementation.
Introduction to the Unified Modeling Language “The act of drawing a diagram does not constitute analysis or design. … Still, having a well-defined and.
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 20 Object-Oriented.
Forte Seminar, April Reusable Components Ready for Distribution Patrick Steyaert Programming Technology Lab Vrije Universiteit Brussel
Reviewing Recent ICSE Proceedings For:.  Defining and Continuous Checking of Structural Program Dependencies  Automatic Inference of Structural Changes.
Chapter 8 Object Design Reuse and Patterns. Object Design Object design is the process of adding details to the requirements analysis and making implementation.
Object Oriented Software Development
Behavioural Design Patterns Quote du jour: ECE450S – Software Engineering II I have not failed. I've just found 10,000 ways that won't work. - Thomas Edison.
CSCI-383 Object-Oriented Programming & Design Lecture 10.
A Formal Model for Object-Oriented Software Reuse Kim Mens Programming Technology Lab Vrije Universiteit Brussel FNRS MeetingMay 6th, 1997.
Testing OO software. State Based Testing State machine: implementation-independent specification (model) of the dynamic behaviour of the system State:
Behavioral Patterns1 Nour El Kadri SEG 3202 Software Design and Architecture Notes based on U of T Design Patterns class.
Object-Oriented Programming © 2013 Goodrich, Tamassia, Goldwasser1Object-Oriented Programming.
© SERG Software Design (OOD Patterns) Pg 1 Object-Oriented Design Patterns Topics in Object-Oriented Design Patterns Material drawn from [Gamma95,Coplien95]
Ivar Jacobson, Grady Booch, and James Rumbaugh The Unified Software Development Process Addison Wesley, : James Rumbaugh's OOMD 1992: Ivar Jacobson's.
February, 2000Programming Technology Lab, Vrije Universiteit Brussel Component and Framework Reuse Dr. Tom Mens Programming Technology Lab Vrije Universiteit.
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
Chapter 8 Object Design Reuse and Patterns. More Patterns Abstract Factory: Provide manufacturer independence Builder: Hide a complex creation process.
PI2134 Software Engineering IT Telkom.  Layered technology  Software Process  Generic Process (by Pressman)  Fundamental activities (by Sommerville)
February 2000Programming Technology Lab, Vrije Universiteit Brussel Reuse Contracts Managing the evolution of reusable components Dr. Tom Mens Programming.
Reuse Contracts A Historic Overview Dr. Tom Mens Programming Technology Lab Vrije Universiteit Brussel Course OOSE.RC EMOOSE
Banaras Hindu University. A Course on Software Reuse by Design Patterns and Frameworks.
The Observer Pattern (Behavioral) ©SoftMoore ConsultingSlide 1.
Formal Foundations for Software Evolution Programming Technology Lab Tom Mens
October 19, 1998Doctoral Symposium OOPSLA’98 Kim Mens Intentional annotations for evolving object-oriented software Kim Mens Programming Technology Lab.
2000 Research Overview Dr. Kim Mens Programming Technology Lab Vrije Universiteit Brussel.
4 June 1998, Mulhouse, France > ‘98 International Workshop Tom Mens Carine Lucas & Patrick Steyaert Programming Technology.
Documenting Evolving Software Systems through Reuse Contracts Kim Mens Patrick SteyaertCarine Lucas Programming Technology Lab, Vrije Universiteit Brussel.
A Formalism for Transformational Software Evolution Programming Technology Lab Vrije Universiteit Brussel, Belgium Tom Mens
A UML-Based Pattern Specification Technique Presented by Chin-Yi Tsai IEEE TRANSACTION ON SOFTWARE ENGINEERING, VOL. 30, NO. 3, MARCH 2004 Robert B. France,
The Observer Design Pattern Author :Erich Gamma, et al. Source :Elements of Reusable Object-Oriented Software Speaker : Chiao-Ping Chang Advisor : Ku-Yaw.
February 23, 2009Observer Pattern, OOA&D, Rubal Gupta, CSPP, Winter ‘09 Observer Pattern Defines a “one-to-many” dependency between objects so that when.
August 1997 Carine Lucas 1 Documenting Reuse and Evolution with Reuse Contracts Carine Lucas August 1997.
Unit - 3 OBJECT ORIENTED DESIGN PROCESS AND AXIOMS
Sections Inheritance and Abstract Classes
2.3 Collaboration Contracts
Observer Design Pattern
Design Patterns with C# (and Food!)
Design Patterns - A few examples
A Declarative Evolution Framework for Object-Oriented Design Patterns
Web Programming Language
Observer Pattern 1.
Effort Estimation for Changing Requirements
Fundaments of Game Design
A Methodology for the Documentation and Management of Reusable Assets
Reuse Contracts: Managing the Evolution of Reusable Assets
Presentation transcript:

1 Reuse Contracts Patrick Steyaert Programming Technology Lab Vrije Universiteit Brussel WWW:

2 Goal: Object-Oriented Reuse Methodology 4Useful in e.g. commercial software development »solve practical problems: “good” reuse documentation, proliferation of versions, architectural drift, overfeaturing, reuse estimation »validation in practice – cases – tools 4Formal foundation »formal notation »“specification” of frameworks and how applications are derived

3 Framework-based Developement 4Framework implementation »template consisting of abstract classes »contracts govern the interaction »hot spots (variation points in templates) 4Framework reuse »filling in hot spots (contract conformance) »refining the framework (contract refinement, inclusion, …)

4 Class Q Class Y Class R conforming B Contracts (Helm&al.) Class X Class Y Class Z conforming A Participant AParticipant B Contract T 4Contract Specification »participants and type obligations »causal obligation and invariants 4Contract Reuse »conformance »refinement, inclusion

5 Example: Observer Contract Subject subjectState attach(Observer) detach(Observer) notify() getState() setState() Observer observerState update() state forall o in observers o update observerState reflects subjectState INVARIANT Subject setState() -> forall o in observers: o.observerState reflects subjectState self notify

6 Issues … 4What versus how »invariants are not allways specified (specifiable) ! 4Contracts allow “disciplined” reuse »if (and only if) conformance checking is automatic ! 4Contracts are too “coercive” »framework reuse is not necesarily filling in hot spots ! 4Change management »frameworks themselves evolve !

7 Reuse Contracts 4Two-sided specification of contracts »framework specifies what can be assumed »reuser specifies what is assumed 4Specification that is “structural” »close to the “structure” of the code »static conformance checking »extraction/code generation 4Conflict checking rather than avoidance

8 Quick Case Study : Reuse in Class Hierarchies Abstract A SubClass B SubClass C Abstract A SubClass B SubClass C SubClass D parent class change ? ?

9 Specialisation Clauses declaring (part of) the specialisation interface Set add(Element) addAll(Set) Set add(Element) addAll(Set) [add] Class Set method add (e:Element) = 0 method addAll(aSet:Set) = begin for e in aSet do self.add(e) end End implementation will invoke add Specialisation clauses declare the assumptions that can be made about a class !

10 Estimating Reuse with Specialisation Clauses CountingSet add(Element) [count] I am certain that I need to override both add and addAll. Set add(Element) [] addAll(Set) [] CountingSet add(Element) [count] Set add(Element) [] addAll(Set) [add] addAll(Set) [count] I have an indication that I only need to override add (addAll can be reused). count() []

11 Evolution in Class Hierarchies Changing a method

12 Example Set add(Element) addAll(Set) CountingSet add(Element) Set (Optimized) addAll(Set) add(Element) addAll(Set) CountingSet add(Element) addAll(Set) not all elements are counted count()

13 Changing Assumptions add(Element) addAll(Set) [add] Assumption made by reuser (before change) CountingSet Assumes add(Element) addAll(Set) [] What can be assumed (after change) CountingSet Actually gets

14 BUT… CountingSet add(Element) SomeSet …concrete parent class … add(Element) addAll(Set) [add] Assumes Too verbose ! Does not document how SomeSet is actually reused !

15 Declaring How a Class is Actually Reused documenting different kinds of reuse Set add addAll [add] CountingSet count Refinement 3 add [+count] add [count] Set add addAll [add] CountingSet count add [count]

16 Different Kinds of Reuse 3Assumption “preserving” »Concretisation: filling in the “hot spots” »Refinement: refining the overall design »Extension: adding new behaviour 3Assumption “breaching” »Abstraction: generalisation »Coarsening: performance optimisation »Cancellation: fixes, elimination of needless features

17 Set add addAll [add] CountingSet count add [count] Estimating Impact of Changes Coarsening 3 addAll [-add] addAll needs to be overridden too Set add addAll [add] CountingSet count add [count] Refinement 3 add [+count] Refinement 3 add [+count]

18 Checking Conflicts Base Contract M1 M2 Derived Contract New Base Contract Possible conflicts Interface conflicts Method capture Inconsistent methods Unimplemented methods Dangling reference Unanticipated recursion

19 Reuse Contracts for Inheritance Asset reuser Asset provider 3 rules for detecting conflicts Set add() addAll() [add] Refinement 3 add […] 3 specialisation clauses declare how to reuse a class »formally »non-coercively 3 operators declare how a class is reused »formally »disciplined

20 Multi-class Reuse Contracts node accept isDestinationFor handle send packet visit [action] action accept [visit] visit [isDestinationFor, send] action [handle] Contract: Packet Handling participant specification e.g. class, module, object … communication specification e.g. message, event, …

21 LAN Contracts node accept(Packet) [send] send(Packet) nextNode accept(Packet) send[accept] Contract: Packet Forwarding next outputServer(node) accept(Packet) [+isDestinationFor, send, +handle] +isDestinationFor(Packet) +handle(Packet) send(Packet) Contract: Packet Handling Refines: Packet Forwarding Refinement

22 LAN Contracts packet +visit(Node) [action] +action(Node) accept [+visit] visit [isDestinationFor, send] action [handle] Contract: Point To Point Communication Factorisation of: Packet Handling outputServer(node) accept(Packet) [isDestinationFor, send, handle] isDestinationFor(Packet) handle(Packet) send(Packet) Contract: Packet Handling Refines: Packet Forwarding Factorisation outputServer(node) accept(Packet) [-isDestinationFor, -send, -handle]

23 Impact Analysis Changing a method AB AB Conflict when merging both modifications M1M1 M2M2 AB

24 Variations on Communication outputServer broadcastPacket(packet) action(Node) action [handle, +send] Contract: Broadcasting Refines: Point To Point Communication outputServer collector(broadcastPacket) action(Node) [+addName] +addName() accept [visit] action: [-handle, send] Contract: NameCollecting Coarsens, Refines: Broadcasting

25 Variations on Network Structure gateway(node) +relay(Packet) handle(Packet) [+relay] Contract: GatewayCommunication Refines, Extends: Point To Point Communication

26 Conflicts ? node packet action [handle, +send] Contract: Broadcasting Refines: Point To Point Communication outputServer(node) accept(Packet) isDestinationFor(Packet) handle(Packet) send(Packet) packet visit(Node) [action] action(Node) accept [visit] visit [isDestinationFor, send] action [handle] Contract: PointToPointCommunication Contract: GatewayCommunication Refines, Extends: Point To Point Comm. gateway(node) +relay(Packet) handle(Packet) [+relay]

27 Conflicts ! node collector action: [-handle, send] Contract: NameCollecting outputServer(node) accep(Packet) isDestinationFor(Packet) handle(Packet) send(Packet) packet visit(Node) [action] action(Node) accept [visit] visit [isDestinationFor, send] action [handle] Contract: PointToPointCommunication Contract: GatewayCommunication Refines, Extends: Point To Point Comm. gateway(node) +relay(Packet) handle(Packet) [+relay]

28 Composition Problem ! Gateway NameCollector DomainAddress

29 Combined Reuse Operators extension m+n M1 refinement m[+n] M2 extension m [n]+x M1 refinement x[+n] M2 coarsening m[-n] M2 extension m+n M1 refinement n[+m] M2 Connected extension Extending refinement coarsening n m[n] m[-n] M1 cancellation -n M2 Coarsening cancellation Factorisation

30 Checking Conflicts A M1 M2 M3 N1 Conflicts ?

31 Reuse Contracts & OOD node:Node accept [send] send nextNode:Node accept send[accept] Node accept [send] send send[accept] next previous Object level: Class level: Other issues: 4Multiplicity 4Super 4Inheritance 4Parameters, results

32 Current & Future Work (I) 4Reuse Contracts for OO + established for inheritance and multi-classes + embedding in OOA/OOD … ? more expressive interaction specifications 4Formal Foundation + formalisation on “operational level” ? completeness, soundness 4Cases and methodolgy + OO Partners (CACM paper), EDS, student projects ? still needs lots of work 4Architecture, frameworks and design patterns 4Tools

33 Drawing Editor Firstname Lastname Age Person Editor License Brand Age Car Editor Person Car Drawing Reusable Architectures ??

34 Design Patterns Subject attach(Observer) detach(Observer) notify() getState() setState() [notify] Observer update() ConcreteObserver update() ConcreteSubject subjectState getState() setState() [notify] notify [update] subject update [getState] concretisation 3update concretisation 3getState, setState implementation must invoke update ConcreteSubject must make Subject concrete

35 4Major technical challenges before reuse becomes standard practice: »disciplined, non-coercive reuse »“good” reuse documentation that can be used in practice »proliferation of versions, iterative development »estimates/ testing/ metrics 4Reuse contract between asset provider and reuser »declare how an asset can be reused, and is reused »formal rules for change propagation 4Towards a reuse methodology … »… emphasising the co-operation between asset provider and asset reuser Conclusion