February 2000Programming Technology Lab, Vrije Universiteit Brussel Reuse Contracts Managing the evolution of reusable components Dr. Tom Mens Programming.

Slides:



Advertisements
Similar presentations
1 A Graph Rewriting Formalism for Object-Oriented Software Evolution Tom Mens FWO Postdoctoral Fellow Programming Technology Lab Vrije.
Advertisements

The design process IACT 403 IACT 931 CSCI 324 Human Computer Interface Lecturer:Gene Awyzio Room:3.117 Phone:
SOFTWARE MAINTENANCE 24 March 2013 William W. McMillan.
1 Reuse Contracts Patrick Steyaert Programming Technology Lab Vrije Universiteit Brussel WWW:
CS 106 Introduction to Computer Science I 04 / 11 / 2008 Instructor: Michael Eckmann.
Requirements and Design
CS 106 Introduction to Computer Science I 11 / 26 / 2007 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 11 / 15 / 2006 Instructor: Michael Eckmann.
Criteria for good design. aim to appreciate the proper and improper uses of inheritance and appreciate the concepts of coupling and cohesion.
Software AutomationMarch Managing the Evolution of Reusable Assets Theo D’Hondt Patrick Steyaert Programming Technology Lab Vrije Universiteit Brussel.
Software Issues Derived from Dr. Fawcett’s Slides Phil Pratt-Szeliga Fall 2009.
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
Chapter 9 – Software Evolution and Maintenance
SEG Software Maintenance1 Software Maintenance “The modification of a software product after delivery to correct faults, to improve performance or.
(c) University of Washington04-1 CSC 143 Java Inheritance Example (Review)
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 18 Slide 1 Software Reuse.
Design Patterns.
CS 106 Introduction to Computer Science I 04 / 13 / 2007 Friday the 13 th Instructor: Michael Eckmann.
EMOOSE Object-Oriented Software Evolution Dr. Tom Mens Programming Technology Lab Vrije Universiteit.
Object-oriented Software Engineering with Reuse Contracts Koen De Hondt, Carine Lucas, Kim Mens, Tom Mens, Patrick Steyaert, Roel Wuyts Programming Technology.
CISC6795: Spring Object-Oriented Programming: Polymorphism.
Course: Software Engineering © Dr Alessandra RussoUnit 5: Aggregation and Inheritance, slide number 1 Unit 5: Aggregation and Inheritance This unit aims.
“Enhancing Reuse with Information Hiding” ITT Proceedings of the Workshop on Reusability in Programming, 1983 Reprinted in Software Reusability, Volume.
Chapter 8 Architecture Analysis. 8 – Architecture Analysis 8.1 Analysis Techniques 8.2 Quantitative Analysis  Performance Views  Performance.
SWE 316: Software Design and Architecture – Dr. Khalid Aljasser Objectives Lecture 11 : Frameworks SWE 316: Software Design and Architecture  To understand.
OHTO -99 SOFTWARE ENGINEERING “SOFTWARE PRODUCT QUALITY” Today: - Software quality - Quality Components - ”Good” software properties.
© S. Demeyer, S. Ducasse, O. Nierstrasz Intro.1 1. Introduction Goals Why Reengineering ?  Lehman's Laws  Object-Oriented Legacy Typical Problems  common.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 1: Software and Software Engineering.
Software Engineering Principles Principles form the basis of methods, techniques, methodologies and tools Principles form the basis of methods, techniques,
OHTO -99 SOFTWARE ENGINEERING “SOFTWARE PRODUCT QUALITY” Today: - Software quality - Quality Components - ”Good” software properties.
Formal Foundations for Software Evolution Programming Technology Lab Tom Mens
SCALABLE EVOLUTION OF HIGHLY AVAILABLE SYSTEMS BY ABHISHEK ASOKAN 8/6/2004.
GoF Sections Design Problems and Design Patterns.
Chapter 8 Object Design Reuse and Patterns. Object Design Object design is the process of adding details to the requirements analysis and making implementation.
Lecture 14 Maintaining the System and Managing Software Change SFDV Principles of Information Systems.
Distribution and components. 2 What is the problem? Enterprise computing is Large scale & complex: It supports large scale and complex organisations Spanning.
Object Oriented Software Development
 All calls to method toString and earnings are resolved at execution time, based on the type of the object to which currentEmployee refers.  Known as.
1 Knowledge Acquisition and Learning by Experience – The Role of Case-Specific Knowledge Knowledge modeling and acquisition Learning by experience Framework.
CASE (Computer-Aided Software Engineering) Tools Software that is used to support software process activities. Provides software process support by:- –
A Formal Model for Object-Oriented Software Reuse Kim Mens Programming Technology Lab Vrije Universiteit Brussel FNRS MeetingMay 6th, 1997.
M1G Introduction to Programming 2 5. Completing the program.
Object Oriented Programming
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Software Engineering Zhang Shuang
Testing OO software. State Based Testing State machine: implementation-independent specification (model) of the dynamic behaviour of the system State:
1 Requirements Engineering From System Goals to UML Models to Software Specifications Axel Van Lamsweerde.
UML (Unified Modeling Language)
February, 2000Programming Technology Lab, Vrije Universiteit Brussel Component and Framework Reuse Dr. Tom Mens Programming Technology Lab Vrije Universiteit.
Banaras Hindu University. A Course on Software Reuse by Design Patterns and Frameworks.
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.
Banaras Hindu University. A Course on Software Reuse by Design Patterns and Frameworks.
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
August 1997 Carine Lucas 1 Documenting Reuse and Evolution with Reuse Contracts Carine Lucas August 1997.
Design Patterns: MORE Examples
Low Budget Productions, LLC
The Systems Engineering Context
Distribution and components
A Declarative Evolution Framework for Object-Oriented Design Patterns
Effort Estimation for Changing Requirements
A Methodology for the Documentation and Management of Reusable Assets
Reuse Contracts: Managing the Evolution of Reusable Assets
Software Maintenance Part1 Introduction. Outlines What Is Software Maintenance Purposes of Maintenance Why We Need It Maintenance Difficilties Some Tips.
Refactoring.
Presentation transcript:

February 2000Programming Technology Lab, Vrije Universiteit Brussel Reuse Contracts Managing the evolution of reusable components Dr. Tom Mens Programming Technology Lab Vrije Universiteit Brussel Course OOSE.RC EMOOSE

February 2000Programming Technology Lab, Vrije Universiteit Brussel Goals Explain relation between reuse and evolution Discuss technical problems that occur when reusable components evolve Explain the “reuse contract” technique for dealing with evolution and reuse of software components Discuss how to incorporate this technique in tools that support reuse and evolution

February 2000Programming Technology Lab, Vrije Universiteit Brussel Software Evolution... … is unavoidable … is crucial to reuse … is needed to reverse the effects of software aging

February 2000Programming Technology Lab, Vrije Universiteit Brussel Evolution is Unavoidable There are many reasons why components evolve: new requirements new technology –software –hardware new insights in the domain iterative development...

February 2000Programming Technology Lab, Vrije Universiteit Brussel Evolution is Unavoidable... maintenance use of components beyond their original goals reuse of components in other software systems Heisenberg 1 principle of software development … 1 requirements start changing from the moment you start building or using a software system

February 2000Programming Technology Lab, Vrije Universiteit Brussel Evolution is Crucial to Reuse Reusable components have a long life span Requirements might be incorrect or incomplete and evolve themselves It is inconceivable to anticipate all possible reuses Reuse can only be achieved after numerous reuses and adaptations

February 2000Programming Technology Lab, Vrije Universiteit Brussel Evolution is Crucial to Reuse change propagation Iterative Learning Process case knowledge application components domain components cross-domain components

February 2000Programming Technology Lab, Vrije Universiteit Brussel Software Aging Programs, like people, get old. We can’t prevent aging, but we can understand its causes, take steps to limit its effects, temporarily reverse some of the damage it has caused, and prepare for the day when the software is no longer viable. [Parnas94] We need to learn how to reverse the effects of aging!

February 2000Programming Technology Lab, Vrije Universiteit Brussel Reasons Why Software Ages lack of movement maintenance ignorant surgery and architectural erosion inflexibility from the start inadequate documentation deadline pressure... The difference between legacy systems and reusable software is the ability to change !

February 2000Programming Technology Lab, Vrije Universiteit Brussel Goals Explain relation between reuse and evolution Discuss technical problems that occur when reusable components evolve Explain the “reuse contract” technique for dealing with evolution and reuse of software components Discuss how to incorporate this technique in tools that support reuse and evolution

February 2000Programming Technology Lab, Vrije Universiteit Brussel Evolution Must be Managed Version proliferation Lack of domain insight Improper reuse and composition Architectural drift Overfeaturing Ripple effect (butterfly effect) Traceability problems

February 2000Programming Technology Lab, Vrije Universiteit Brussel Ripple effect! Change propagation Modifying a component Issue: Impact Analysis

February 2000Programming Technology Lab, Vrije Universiteit Brussel Some Typical Evolution Conflicts (component = class) Signature collision: two developers introduce or remove the same method signature Method body conflict: two developers change the body of the same method Dangling reference: one developer refers to a method while the other one removes it Method capture: one developer changes a method under the assumption that the method is not invoked, while the other developer adds the method invocation Inconsistent methods: one developer changes a method under the assumption that the method is invoked, while the other developer removes the method invocation

February 2000Programming Technology Lab, Vrije Universiteit Brussel Goals Explain relation between reuse and evolution Discuss some technical problems that can occur when reusable components evolve Explain the “reuse contract” technique for dealing with evolution and reuse of software components Discuss how to incorporate this technique in tools that support reuse and evolution

February 2000Programming Technology Lab, Vrije Universiteit Brussel Current software models are too “static” A system is a set of communicating parts or components that collaborate to realise a certain behaviour A part or component is understood to be a systems building block that is defined by its external interface (like an ADT). A software architecture is a specification of a set of components and a communication pattern or protocol among them to achieve the behaviour. Software models should take evolution into account!

February 2000Programming Technology Lab, Vrije Universiteit Brussel Reuse Contracts

February 2000Programming Technology Lab, Vrije Universiteit Brussel Reuse Contracts Technique for documenting reuse/evolution of: –single (abstract) classes, collaborating set of classes, applications, frameworks, software architectures,... Improve reuse at the design level –highlight reuse information at the design level Manage change/evolution –make estimation of the impact of a change to a class/framework more easy Enhance existing OO methodologies

February 2000Programming Technology Lab, Vrije Universiteit Brussel cross-domain components domain components application components General Idea provider reuser contract provider reuser contract

February 2000Programming Technology Lab, Vrije Universiteit Brussel Provider (Re-) users Changing a method Case Study (1): Evolution in Class Hierarchies

February 2000Programming Technology Lab, Vrije Universiteit Brussel DesktopFolder xpos, ypos contents move add addMany Example evolution DesktopFolder xpos, ypos contents move add addMany SizedFolder add size size + item.size SizedFolder add size size + item.size size is not updated when adding many items

February 2000Programming Technology Lab, Vrije Universiteit Brussel Changing Assumptions Reuse imposes obligations! add addMany {invokes add} Assumption made by reuser (before evolution) SizedFolder Assumes add addMany {} What can be assumed (after evolution) SizedFolder Actually gets

February 2000Programming Technology Lab, Vrije Universiteit Brussel xpos, ypos contents move add addMany {add} DesktopFolder Specialisation Interface The specialisation interface declares the assumptions that can be made about a class and how it can be reused. DesktopFolder xpos, ypos contents move add addMany documenting the specialisation interface implementation will invoke add Class DesktopFolder... method add (el) =... method addMany (set) = begin for each el in set do self.add(el) end

February 2000Programming Technology Lab, Vrije Universiteit Brussel Contract Types Document the intentions of reusers by –telling the component provider how a component is reused –documenting good (re-)uses but also “hacks” Impose restrictions –extenders may only add new services –refiners may not add new services –concretisers may only “fill in the hot spots”

February 2000Programming Technology Lab, Vrije Universiteit Brussel Kinds of Contract Types Obligation “full-filling” –Concretisation: filling in the “hot spots” Obligation “strengthening” –Refinement: refining the overall model –Extension: adding new services Obligation “relaxing” –Coarsening: e.g., performance optimisation –Cancellation: removing needless features

February 2000Programming Technology Lab, Vrije Universiteit Brussel DesktopFolder xpos, ypos contents move add addMany {add} SizedFolder add {size:} size Documenting Reuse with Contract Types documenting different kinds of reuse DesktopFolder xpos, ypos contents move add addMany {add} SizedFolder add {size:} size Refinement add {+ size:}

February 2000Programming Technology Lab, Vrije Universiteit Brussel Documenting Reuse with Contract Types DesktopFolder xpos, ypos contents move add addMany {add} DesktopFolder xpos, ypos contents move add addMany evolution DesktopFolder xpos, ypos contents move add addMany {add} DesktopFolder xpos, ypos contents move add addMany Coarsening addMany {- add} documenting kind of reuse

February 2000Programming Technology Lab, Vrije Universiteit Brussel Estimating the Impact of Changes Coarsening addMany {- add} DesktopFolder xpos, ypos contents move add addMany {add} SizedFolder add {size:} size Refinement add {+ size:} DesktopFolder xpos, ypos contents move add addMany {} SizedFolder add {size:} size Refinement add {+ size:} Effort estimation : addMany needs to be overridden too

February 2000Programming Technology Lab, Vrije Universiteit Brussel extension refinement coarsening extensionrefinementcoarsening no conflicts inconsistent methods interface conflicts method capture, unanticipated recursion method capture, inconsistent methods no conflicts method capture, inconsistent methods Impact Analysis

February 2000Programming Technology Lab, Vrije Universiteit Brussel 3rules for impact analysis (conflict detection) Reuser 3declares how a com- ponent is reused 3declares what assumptions are made about the component 3formally, disciplined Provider 3declares how a com- ponent can be reused; 3declares what assumptions can be made about the software; 3formally, non- coercively Summary

February 2000Programming Technology Lab, Vrije Universiteit Brussel Kinds of conflicts syntactic conflicts –lead to an ill-formed result semantic conflicts –lead to a result that contains unexpected behaviour / unexpected side-effects /... structural conflicts –occur after restructuring or refactoring

February 2000Programming Technology Lab, Vrije Universiteit Brussel Syntactic Conflicts Can typically be checked by a compiler Examples –Double occurences Accidentally adding the same method in a base class and one of its subclasses (can also occur during renaming) –Dangling method call Adding a call to a method that is removed by base class exchange

February 2000Programming Technology Lab, Vrije Universiteit Brussel Example: Syntactic Conflict Cancellation add DesktopFolder xpos, ypos contents move add Extension addMany {+ add} DesktopFolder xpos, ypos contents move Dangling method call! ExtDesktop addMany {add}

February 2000Programming Technology Lab, Vrije Universiteit Brussel Exercise: Syntactic Conflicts Give a few examples of syntactic conflicts that have to do with self sends and/or super sends.

February 2000Programming Technology Lab, Vrije Universiteit Brussel Solution: Syntactic Conflicts Coarsening m A mnmn Refinement m {+ super} Dangling super call! B m{super} A n

February 2000Programming Technology Lab, Vrije Universiteit Brussel Semantic Conflicts Cannot be checked by a compiler Examples –inconsistent methods see earlier example (refinement vs coarsening) –method capture making a call to a method whose implementation is being modified –unanticipated recursion adding two method calls in the opposite direction

February 2000Programming Technology Lab, Vrije Universiteit Brussel Exercise: Semantic conflicts Give a few examples of more complex semantic conflicts that have to do with self sends or super sends?

February 2000Programming Technology Lab, Vrije Universiteit Brussel Solution a: Semantic Conflicts Refinement m {+ self.n} A m n {… body …} Coarsening n {- body} Calling m in B after base class exchange gives a run-time error because it indirectly calls the unimplemented method n from B! B n { shouldNotImplement } A m {self.n} n {… body …}

February 2000Programming Technology Lab, Vrije Universiteit Brussel Solution b: Semantic Conflicts Refinement p {+ self.m} A m {self.n} n Calling B n {self.p} p B n {self.p} m {self.m} C p {super} Calling p in C after base class exchange gives rise to an infinite recursion (due to late- binding of self)!

February 2000Programming Technology Lab, Vrije Universiteit Brussel Structural Conflicts Occur when the framework is being restructured Examples –introducing an intermediate abstract class –splitting up the behaviour of one class in two new (associated) classes –...

February 2000Programming Technology Lab, Vrije Universiteit Brussel Restructuring conflict. In the merge, Safe should not be handled by Bank, but by Agency. Example: Structural Conflict restructure the framework by introducing an intermediate class Agency extend the framework by introducing a new class Safe Bank Account isHandledBy Loan isHandledBy Company Agency Account isHandledBy Loan isHandledBy Bank Company represents Bank Account isHandledBy Loan isHandledBy Company Safe isHandledBy Agency Safe isHandledBy Account isHandledBy Bank Company represents Loan isHandledBy

February 2000Programming Technology Lab, Vrije Universiteit Brussel Identity MaleFemaleCompany Transformed Male Transformed Female Identity MaleFemaleCompany Restructuring conflict. When these two parallel modifications are merged, should TransformedMale and TransformedFemale be put under Person, Identity or MoralPerson? What with other classes? Identity MaleFemaleCompany PersonMoralPerson restructure the framework by introducing intermediate classes Person and MoralPerson extend the framework by introducing new classes TransformedMale and TransformedFemale Example: Structural Conflict

February 2000Programming Technology Lab, Vrije Universiteit Brussel Exercise: Structural Conflict Try to find a general characterisation of a restructuring transformation based on the two examples. Try to find a general characterisation of a restructuring conflict using the above characterisation.

February 2000Programming Technology Lab, Vrije Universiteit Brussel OldNode DepNode2 DepNode3 DepNode1 DepNode2 DepNode3 DepNode1 Part1Part2 PartN Restructure (OldNode, [Part1,Part2,…PartN]) Solution a: Restructure Transfo Step 1: replace OldNode by a number of Part-nodes Step 2: redirect all dependencies to or from OldNode to all of the Part-nodes

February 2000Programming Technology Lab, Vrije Universiteit Brussel Restructure (OldNode, [Part1,Part2,…PartN]) Solution b: Restructure Conflict Refinement to or from OldNode Restructure Conflict

February 2000Programming Technology Lab, Vrije Universiteit Brussel Case Study: Bank Example Try to express the design of a Bank-framework, find some interesting evolutions and customisations of the framework, and try to find some interesting evolution conflicts, at class level as well as method level.

February 2000Programming Technology Lab, Vrije Universiteit Brussel Company Bank Company BankAccount Company BankAccount Safe ATM owns Company BankAgencySafeATM Account isHandledBy owns Possible Bank-FW evolutions

February 2000Programming Technology Lab, Vrije Universiteit Brussel CreditAccount balance deposit(value) withdraw(value) creditLimitLog print(action,value) getInfo I S G I S I G All inheritors must satisfy this contract. Contract makes certain assumptions explicit, such as: - withdraw and deposit must always log their actions - withdraw and deposit make changes to balance - withdraw always invokes validate validate(value) G G Base Contract

February 2000Programming Technology Lab, Vrije Universiteit Brussel CreditAccount balance deposit(value) {S ET balance; CALL Log.print} withdraw(value) { GET balance; INVOKE validate; SET balance; CALL Log.print} creditLimit getInfo { GET balance} validate(value) { GET balance; GET withdrawLimit} Base Contract (alternative notation)

February 2000Programming Technology Lab, Vrije Universiteit Brussel Inline behaviour of validate in withdraw for efficiency reasons (but do not remove validate ) Can cause problems in inheritors that rely on the following assumption of the original contract which is not valid anymore - withdraw always invokes validate CreditAccount.2 balance deposit(value) {S ET balance; CALL Log.print} withdraw(value) { GET balance; GET creditLimit; INVOKE validate; SET balance; CALL Log.print} creditLimit getInfo { GET balance} validate(value) { GET balance; GET creditLimit} Evolved Base Contract (base class exchange)

February 2000Programming Technology Lab, Vrije Universiteit Brussel CreditAccount balance deposit(value) {S ET balance; CALL Log.print} withdraw(value) { GET balance; INVOKE validate; SET balance; CALL Log.print} creditLimit getInfo { GET balance} validate(value) { GET balance; GET creditLimit} ATMAccount daylyAmount atmLimit getInfo { INVOKE super; GET daylyAmount} validate(value) { INVOKE super; GET daylyAmount; GET atmLimit} ATMAccount complies to all assumptions of CreditAccount because of super calls Inherited Contract

February 2000Programming Technology Lab, Vrije Universiteit Brussel CreditAccount ATMAccount CreditAccount.2 inline validate in withdraw override validate Breach of assumption that - withdraw always invokes validate ATMAccount Evolution Conflict

February 2000Programming Technology Lab, Vrije Universiteit Brussel DepositAccountSavingsAccount CreditAccount withdraw(value) creditLimit getInfo validate(value) Account balance deposit(value) withdraw(value) getInfo Account contains the basic functionality that is common to all accounts (abstract superclass) A CreditAccount can have a negative balance up to a certain creditLimit. Money can be deposited on a SavingsAccount by everyone, but withdrawing is only possible by transferring the money to the associated DepositAccount. Task: Parallel evolution of Account hierarchy

February 2000Programming Technology Lab, Vrije Universiteit Brussel 1.A TransferAccount is a special kind of account that automatically transfers money to SavingsAccount if a certain upper limit is reached, and leaves a preset amount on the original account. 2.Allow to remove money from the account by drawing a cheque, as long as the cheque has been approved by the bank 3.Security: money can only be withdrawn after having provided a password. 4.Phone banking: account can be accessed by phone via a special interface, and provided that the correct pin code is provided 5.Internet banking: account can be accessed by internet, after having provided a password. Typically, internet banking offers more features than phone banking. 6.Add logging information to accounts 7.Account warns user during withdraw when balance is going to be negative 8.Add an extra transfer operation to transfer money from account to other accounts 9.Add behaviour for calculating the interest rate. SavingsAccount has higher interest than DepositAccount. They also have a fidelityBonus and growthBonus calculated on a annual basis. If balance is negative on a creditAccount, a high negative intrest is charged. 10.Add behaviour for calculating the cost charged by the bank for managing the account. Some accounts have a default cost per year, other accounts require a small fee for each transaction being made, but do not require fees for electronic transactions (phone banking and internet banking) 11.Accounts specifically for persons below 18 years, with higher intrest rates and other bonusses. Some possible evolutions