A Formal Model for Object-Oriented Software Reuse Kim Mens Programming Technology Lab Vrije Universiteit Brussel FNRS MeetingMay 6th, 1997.

Slides:



Advertisements
Similar presentations
Introduction to Java 2 Programming
Advertisements

By Waqas Over the many years the people have studied software-development approaches to figure out which approaches are quickest, cheapest, most.
1 A Graph Rewriting Formalism for Object-Oriented Software Evolution Tom Mens FWO Postdoctoral Fellow Programming Technology Lab Vrije.
1 Reuse Contracts Patrick Steyaert Programming Technology Lab Vrije Universiteit Brussel WWW:
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.
CS 211 Inheritance AAA.
Georgia Institute of Technology Workshop for CS-AP Teachers Chapter 3 Advanced Object-Oriented Concepts.
Classes & Objects Computer Science I Last updated 9/30/10.
1 Software Testing and Quality Assurance Lecture 12 - The Testing Perspective (Chapter 2, A Practical Guide to Testing Object-Oriented Software)
1 Software Testing and Quality Assurance Lecture 28 – Testing Class Hierarchies.
Fall 2007ACS-1805 Ron McFadyen1 Programming Concepts Chapter 4 introduces more advanced OO programming techniques. Construction of a programs usually requires:
November 13, 2006ECEN 5543 / CSCI 5548 – Testing OO University of Colorado, Boulder 1 Testing Object-Oriented Software Principles Summary ECEN 5543 / CSCI.
Aalborg Media Lab 23-Jun-15 Inheritance Lecture 10 Chapter 8.
Software AutomationMarch Managing the Evolution of Reusable Assets Theo D’Hondt Patrick Steyaert Programming Technology Lab Vrije Universiteit Brussel.
Vrije Universiteit amsterdamPostacademische Cursus Informatie Technologie Themes and Variations abstraction -- the object metaphor modeling -- understanding.
Chapter 10 Classes Continued
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 1 Introduction to Object-Oriented Programming and Software Development.
CSCI-383 Object-Oriented Programming & Design Lecture 15.
SEG Software Maintenance1 Software Maintenance “The modification of a software product after delivery to correct faults, to improve performance or.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 2: Modelling.
Design Patterns.
Object-oriented Software Engineering with Reuse Contracts Koen De Hondt, Carine Lucas, Kim Mens, Tom Mens, Patrick Steyaert, Roel Wuyts Programming Technology.
OOPs Object oriented programming. Based on ADT principles  Representation of type and operations in a single unit  Available for other units to create.
(C) 2010 Pearson Education, Inc. All rights reserved. Java™ How to Program, 8/e.
1 CS 456 Software Engineering. 2 Contents 3 Chapter 1: Introduction.
Formal Foundations for Software Evolution Programming Technology Lab Tom Mens
CSSE501 Object-Oriented Development. Chapter 11: Static and Dynamic Behavior  In this chapter we will examine the differences between static and dynamic.
Sommerville 2004,Mejia-Alvarez 2009Software Engineering, 7th edition. Chapter 8 Slide 1 System models.
Introduction to UML: Unified Modeling Language Ric Holt U Waterloo, March 2009 CS246.
Object Oriented Software Development
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
1 OO Analysis & Design - Introduction to main ideas in OO Analysis & design - Practical experience in applying ideas.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
OOPs Object oriented programming. Abstract data types  Representationof type and operations in a single unit  Available for other units to create variables.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Testing OO software. State Based Testing State machine: implementation-independent specification (model) of the dynamic behaviour of the system State:
Computer Science I Classes and objects Classwork/Homework: Examine and modify my examples. Make your own.
Inspired by the Oulipu. The 3 Tenets of OO Encapsulation Polymorphism Inheritance.
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
PROGRAMMING PRE- AND POSTCONDITIONS, INVARIANTS AND METHOD CONTRACTS B MODULE 2: SOFTWARE SYSTEMS 13 NOVEMBER 2013.
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
Formal Foundations for Software Evolution Programming Technology Lab Tom Mens
1 SWE Introduction to Software Engineering Lecture 14 – System Modeling.
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
Lecture 2 Intro. To Software Engineering and Object-Oriented Programming (2/2)
Notices Assn 2 is due tomorrow, 7pm. Moodle quiz next week – written in the lab as before. Everything up to and including today’s lecture: Big Topics are.
CSCI 383 Object-Oriented Programming & Design Lecture 15 Martin van Bommel.
August 1997 Carine Lucas 1 Documenting Reuse and Evolution with Reuse Contracts Carine Lucas August 1997.
Modern Programming Tools And Techniques-I
Sections Inheritance and Abstract Classes
JAVA By Waqas.
Inheritance and Polymorphism
2.3 Collaboration Contracts
CS240: Advanced Programming Concepts
A Declarative Evolution Framework for Object-Oriented Design Patterns
Intentional source-code views
Effort Estimation for Changing Requirements
Object-Oriented Programming: Inheritance and Polymorphism
Fundaments of Game Design
A Methodology for the Documentation and Management of Reusable Assets
Inheritance and Polymorphism
Reuse Contracts: Managing the Evolution of Reusable Assets
Refactoring.
Presentation transcript:

A Formal Model for Object-Oriented Software Reuse Kim Mens Programming Technology Lab Vrije Universiteit Brussel FNRS MeetingMay 6th, 1997

2 Contents l Object-Oriented Programming l OO Software Reuse and Evolution l Our Approach: Reuse Contracts l Software Engineering Tools based on Reuse Contracts

3 Object-Oriented Programming Objects contain both data ( instance variables ) and operations ( methods ). Operations can be invoked and variables retrieved by means of message sending. Classes are “templates” for objects. Objects of the same class ( instances ) have the same implementation, but different internal state. The implementation of existing classes can be reused (specialised) by means of inheritance.

4 Classes and Objects DesktopFolder (HardDisk) xpos:600, ypos: 10, contents:... class DesktopFolder (name:String) instance variables xpos, ypos : Number contents : Set(DesktopItem) methods move (dx,dy:Number) = xpos.plus(dx); ypos.plus(dy) add (item:DesktopItem) = contents. include(item) addMany (group:Set(DesktopItem)) foreach item in group do self. add(item) DesktopFolder (TrashCan) xpos:580, ypos: 640, contents:... self send instances message send

5 Inheritance class DesktopFolder (name:String) instance variables xpos, ypos : Number contents : Set(DesktopItem) methods move (dx,dy:Number) =... add (item:DesktopItem) =... addMany (group:Set(DesktopItem)) class SizedFolder inherits from DesktopFolder instance variables size : Number methods add (item:DesktopItem) = super. add(item); size. plus(item.getsize()) super send inheritance parent class (super) child class

6 Software Reuse and Evolution Software Reuse = Reusing existing software parts in new systems. Software Evolution = Updating system parts by more recent versions. Both evolution and reuse give rise to similar problems.

7 What can go wrong... 4 Ariane 4 »well-tested software »proven correctly 4 Ariane 5 »reuse of pieces of Ariane 4 software »result: trivial error (floating point error), large consequences 4 What happened ? »changed flight specifications

8 OO Software Reuse and Evolution l Current notations/methodologies/tools insufficiently support software reuse – support code reuse rather than design reuse – insufficiently document important dependencies – are too informal l Need for contract between software providers and reusers. – how can a software component be reused? – how is it actually reused?

9 Object Modelling Technique (OMT) DesktopFolder xpos, ypos contents move add addMany SizedFolder add size class DesktopFolder (name:String) instance variables xpos, ypos : Number contents : Set(DesktopItem) methods move (dx,dy:Number) = xpos.plus(dx); ypos.plus(dy) add (item:DesktopItem) = contents. include(item) addMany (group:Set(DesktopItem)) foreach item in group do self. add(item) class SizedFolder inherits from DesktopFolder instance variables size : Number methods add (item:DesktopItem) = super. add; size. plus(item.getsize())

10 Our Approach: Reuse Contracts Software Reuser Software Provider 3rules for change propagation (conflict detection) 3declares how a com- ponent is reused 3declares what assumptions are made about the component 3formally, disciplined 3declares how a com- ponent can be reused; 3declares what assumptions can be made about the software; 3formally, non-coercively

11 Case Study: Reuse of Classes through Inheritance Class A SubClass B SubClass C Class A’ SubClass B’ SubClass C’ parent class exchange ?

12 Step 1: Documenting the Design documenting (part of) the specialisation interface Specialisation interface The specialisation interface declares the assumptions that can be made about a class and how it can be reused. invokes add DesktopFolder xpos, ypos contents move add addMany DesktopFolder xpos, ypos contents move add addMany {add}

13 Step 2: Declaring How a Class is Reused documenting different kinds of reuse The reuse operators declare the assumptions that are made about a class and how it is reused. DesktopFolder xpos, ypos, contents move add addMany {add} SizedFolder add {size} size Refinement  add{+theSize} DesktopFolder xpos, ypos, contents move add addMany {add} SizedFolder add {size} size

14 Different Kinds of Reuse 3 Design “specialising” » Concretisation : replacing dummy or default method implementations by more specific ones » Extension : adding new behaviour » Refinement : refining the overall design by adding method dependencies 3 Design “generalising” » Abstraction : opposite of concretisation » Cancellation : removing existing behaviour » Coarsening : removing method dependencies

15 size is not updated when adding many items Inconsistent Methods evolution size + item.getSize() DesktopFolder xpos, ypos contents move add addMany SizedFolder add size DesktopFolder xpos, ypos contents move add addMany SizedFolder add size size + item.getSize() OMT notation

16 Evolution Conflict Detection Refinement  add{+size} Coarsening 3addMany {-add} Refinement  add{+size} Inconsistent Methods addMany needs to be overridden too RC notation DesktopFolder xpos, ypos, contents move add addMany {add} SizedFolder add {size} size DesktopFolder xpos, ypos, contents move add addMany {add} SizedFolder add {size} size

17 Step 3: Formal Model & Rules for Conflict Detection Formal model of … reuse contracts, reuse operators, and applicability Formal rules for... detecting conflicts on parent class exchange  automated conflict checking possible !

18 Reuse contracts for inheritance Software Reuser Software Provider Refinement ¦ add{+size} Reuse contract between provider and reuser » declares how a component can be reused and is reused » formal rules for change propagation DesktopFolder xpos, ypos, contents move add addMany {add}

19 Software Engineering Tools based on Reuse Contracts l Impact Analysis & Conflict Detection l Documenting Structure & Design of Software l Extracting Reuse Contracts (from source code)  Reverse Engineering l Verifying Compliance (of code) to Reuse Contracts  Enforcing Design l Generating Code l Quality Assessment of Software Design

20 More Information my