SlideShare uma empresa Scribd logo
1 de 68
Baixar para ler offline
Reuse Contracts as a basis for
     investigating reusability of
           Smalltalk code
                      Koen De Hondt
               Programming Technology Lab
               Computer Science Department
                 Vrije Universiteit Brussel

      kdehondt@vub.ac.be       http:/progwww.vub.ac.be/

1
Overview
     Problems with reuse
     Problems with evolution
     What are reuse contracts?
     Reuse contracts at work
     Examining class hierarchies based on
     reuse contracts
     Reuse contract research
     Exercises: introduction to the browser
2
How do You Reuse a Class?

     Cloning (copy and paste)
     Inheritance / method overriding
     Composition / delegation




3
Reuse by Cloning
    Reused ““components”” are not easily
    adaptable
    –– no support is provided for adaptation/reuse
    No relation between original and result
    –– difficult to maintain since bug fixes and
       upgrades are not propagated to the derived
       application (proliferation of versions)


              !    This kind of reuse should be avoided
4
Reuse by Inheritance
                                           Class A

    How do you determine
      –– what to reuse (inherit)?      Subclass B
      –– what to adapt (override)?
      –– what to write from scratch?
                                       Subclass C


                                       ?
                                       Subclass D

5
Example: Make a Subclass of
    Set
    Framework
                         What to override?
      Set #add:              –– #add: if #addAll: uses #add:
            #addAll:
                             –– #add & addAll: if #addAll:
                                does not use #add:



     CountingSet
                       A CountingSet is a Set that
    Application        counts all added elements

6
Reuse by Composition

    How do you determine
      –– what to reuse (what to compose, what to
         delegate)?
      –– what to adapt (how to compose)?
      –– what to write from scratch?
                                          Class B

                 Class A
                                ?         Class C

7
Reusing a Class is Hard

    Current OOA/OOD notations do not provide
    enough information to reuse a class
    Usually, developers do not document how a class
    can be reused, they only document what each
    method does
    If a class comment contains reuse information, it
    usually has the form of a cookbook
                            Reusers are compelled to
                             inspect the source code
8
Inspecting the Source Code

     To reuse a class:
     –– inspect the class
     –– inspect all its superclasses
     –– inspect all the classes it co-operates with
     Source code inspection is error-prone
     If source code inspection doesn’’t work:
     talk to the developer (i.e. the expert)!

9
What are You Looking for?
     Self sends
     Super sends
                                     Reusers need the
     Abstract methods             specialisation interface
     Template methods
     Default methods
     Methods that are overridden frequently
     Methods that are part of a design pattern
     Co-operation with other objects/classes
     ...

10
Self Sends are Important

     Self sends & template methods & abstract
     methods reify the design of a class
     Method decomposition
     –– distinguish ““core”” methods from ““peripheral””
        methods
     Using self sends = planning for reuse
     –– fine-grained overriding of methods


11
Self Sends: Planning for Reuse
ApplicationModel in VisualWorks 2.5
                                       can be reused with other builders
openInterface: aSymbol
   builder := self builderClass new.
   ...
   “a lot of expressions here”
   ...                                          same external interface
                                                (#builderClass is private)
ApplicationModel in VisualWorks 2.0

openInterface: aSymbol
   builder := UIBuilder new.
                                       cannot be reused with other builders
   ...
                                       without overriding all methods that
   “a lot of expressions here”
                                       refer to UIBuilder
   ...

12
Co-operation with Other
     Objects/Classes is Important

      Delegation of responsibilities principle
      Using delegation= planning for reuse
      –– a system can easily be extended by adding
         new classes
      –– objects with ““the same interface”” can be
         substituted for each other


13
Delegation: Planning for Reuse
Menu in VisualWorks 2.0
                                        can be reused for
     Menu                   MenuItem    different menu items

                    items

                                               same external behaviour
                                               same interface
PopUpMenu in VisualWorks 1.0
                                                  for instance creation

        PopUpMenu           Strings !

     labels                             cannot be reused for
                                        different menu items

14
Overview
      Problems with reuse
      Problems with evolution
      What are reuse contracts?
      Reuse contracts at work
      Examining class hierarchies based on
      reuse contracts
      Reuse contract research
      Exercises: introduction to the browser
15
Evolution is Important

      Iterative development
      –– a framework is never finished
      Changing requirements
      –– functional: user requirements
      –– non-functional: maintainability,
         adaptibility, reusability, customisability, ...




16
What to do When the
     Framework Changes?
     Framework 1.0                 Framework 2.0

         X                              X
                       Evolution


                                            ?
                   Y                             Y
     Application                   Application

17
Example Evolution Conflict (1)
     Framework 1.0                         Framework 2.0




                                                                       d)
                                                                       te
                                                                     en
                                                 #m




                                                               do d
                                                                   m
      X                                     X




                                                             ot en
          #m




                                                                 cu
                                                           (n lf s
                         Evolution               #p




                                                             se
           #p   Y                                     #p   Y
                                                           Method capture
      i                      instance of     i
           Application       subclass of          Application




18
Example Evolution Conflict (2)
     Framework 1.0                         Framework 2.0
          #m                                     #m
      X                                     X    #p
          #p             Evolution



           #p                                      #p
           #q
                Y                                  #q
                                                        Y
                             self send
                             instance of
                                                 Inconsistent methods
      i    Application                       i    Application
                             subclass of



19
More Evolution Conflicts

      Interface conflicts
      –– the name of a reused method/class has been
         changed
      –– a method that was added by a reuser has been
         introduced by the new version of the framework
      Unanticipated recursion
      –– a method invokes another one in the application
         while the new version of the framework introduces
         an invocation of the first by the latter


20
Spotting Evolution Problems

      Unless the changes to the framework
      are well-documented (informally), the
      application developer is condemned to
      perform code inspection to determine
      what has changed
      Often evolution conflicts are not spotted
      until the application is running based on
      the new version of the framework

21
What are the Challenges?
     Supporting reuse
     –– what can be reused, what must be adapted, and what
        must be built from scratch ?
     –– formal documentation on how classes are reused
     Supporting evolution
     –– change propagation
     Support for estimates/testing/metrics
     –– feasibility of reusing a class
     –– the cost of ““upgrading”” the class repository

22
Overview
      Problems with reuse
      Problems with evolution
      What are reuse contracts?
      Reuse contracts at work
      Examining class hierarchies based on
      reuse contracts
      Reuse contract research
      Exercises: introduction to the browser
23
Reuse Contracts

      Are contracts between the framework
      developer and the application
      developer
      State what assumptions can be made
      about reusable components
      State how components are actually
      reused


24
Reuse Contract Notation

     Notation based on OMT (UML)
     Methods are annotated with
     specialisation clauses to make the
     specialisation interface explicit
     ““Reuse operators””, or ““modifiers””, lay
     down how reuse is achieved



25
Reuse Contracts for Inheritance
                                                       specialisation clause
     Enhance the interface of a class
                                          abstract method
     with specialisation clauses
                                                        Collection
     Identify what changes are made
                                                     #collect: [#do:]
     when a class is subclassed:
                                                     #do:
      –– concretisation/abstraction                  #select: [#do:]
      –– extension/cancellation
                                               concretisation
      –– refinement/coarsening                     #do:
     Specialisation clauses may contain
                                                             Set
     names of methods invoked
                                                     #collect: [#do:]
     through self sends, and ““super””
                                                     #do:
                                   reuse operator    #select: [#do:]


26
Reuse Operator: Concretisation

                                   Collection
     Makes abstract methods     #collect: [#do:]
     concrete                   #do:
                                #select: [#do:]
     Does not change the
     specialisation clause of       concretisation
                                      #do:
     the concretised methods
     Design preserving                  Set
                                #collect: [#do:]
     Inverse = abstraction      #do:
                                #select: [#do:]



27
Reuse Operator: Abstraction
                                        View
                                #preferredBounds [ ]
     Makes a concrete method
     abstract
                                    SimpleView
     Design breaching           #preferredBounds [ ]
     Inverse = concretisation
                                 BasicButtonView
                                #preferredBounds [ ]
                                  abstraction
                                   #preferredBounds
                                LabeledButtonView
                                #preferredBounds [ ]

28
Reuse Operator: Extension
     Typically performed by an
     application developer to add           Collection
     application specific behaviour   ...

     Adds new methods to the                 extension
     interface of a class                      #-
                                               #grow
     Design preserving                         Set
     Inverse = cancellation           ...
                                      #- [ ]
                                      #grow [ ]




29
Reuse Operator: Cancellation
                                             Collection
     Typically performed by an   ...
                                 #add: [ ]
     application developer to    #remove:ifAbsent: [ ]
     remove behaviour                   cancellation
                                          #remove:ifAbsent:
     Removes methods from
     the interface of a class    SequenceableCollection
                                 ...
     Design breaching            #add: [ ]

     Inverse = extension                cancellation
                                          #add:

                                       ArrayedCollection
                                 ...

30
Reuse Operator: Refinement
     Adds elements to the
                                                 Object
     specialisation clause of a
     method                           #postCopy [ ]

     Used to e.g. :                     refinement
                                          #postCopy [super,
     –– reduce redundancy                       + #breakDependents]
     –– specialise the behaviour of              Model
        an existing method with an    #postCopy
        existing behaviour             [super, #breakDependents]

     Design preserving
     Inverse = coarsening
31
Reuse Operator: Coarsening
     Removes elements from
                                       Collection
     the specialisation clause of
     a method                       #size [#do:]

     Used to e.g.:                     coarsening
                                         #size [- #do:]
     –– optimize performance
     Design breaching                       Set
     Inverse = refinement           #size [ ]




32
Reuse Operators

      Make a distinction between different
      kinds of inheritance
      State how a class is derived from its
      superclass
      Are orthogonal basic operators
      Usually, one subclassing step is a
      combination of several reuse operators


33
Frequently Used Combinations
     of Reuse Operators
     Extension & refinement
     Coarsening & cancellation
     Concretisation & refinement
     Concretisation & extension & refinement
     Coarsening & refinement = redefinition
     Coarsening & extension & refinement
     = factorization
34
Multi-Class Reuse Contracts
     (in short)
     Co-operating classes are put in one reuse
     contract; these classes are called ““participants””
     Interfaces of classes as in reuse contracts for
     inheritance
     Specialisation clauses are extended with names
     of methods invoked on other classes
     Reuse operators identify what changes are
     made to a whole contract

35
Reuse Contract Notation
     Interface opening          specialisation clauses              participants

                            #openInterface:                    UIBuilder
        ApplicationModel     [#source:, #add:,             #source:
                              #openWithExtent:]            #add:
        #openInterface:
                                                   builder #openWithExtent:
                self
                                         #openInterface:
                                          [#model:, #displayPendingInvalidation]

        #openInterface:
         [#preBuildWith:,                       ApplicationWindow
          #hookupWindow:spec:builder:,     #model:
          #postBuildWith:,                 #displayPendingInvalidation
          #postOpenWith:]

36
Overview
      Problems with reuse
      Problems with evolution
      What are reuse contracts?
      Reuse contracts at work
      Examining class hierarchies based on
      reuse contracts
      Reuse contract research
      Exercises: introduction to the browser
37
Reuse Contracts at Work
     The formal nature of reuse contracts
     enables their use in a development
     environment
       –– code generation from reuse contracts
       –– impact analysis when a framework
          changes (assessing evolution conflicts)
       –– effort estimation for framework
          customisation
       –– extraction from source code

38
Estimating Reuse
     Framework                  Framework

      Set #add:                  Set #add: [ ]
          #addAll:                    #addAll: [#add:]




             ?
           What to override?
                                 CountingSet
      CountingSet
                                #add: [super, #incCount]
                                #incCount [ ]

                  Application                Application


39
Evolution
     Framework                               Framework

      Set #add: [ ]                           Set #add: [ ]
           #addAll: [#add:]     Evolution           #addAll: [#add:]




      CountingSet                             CountingSet
     #add: [super, #incCount]                 #add: [super, #incCount]
     #incCount [ ]                            #incCount [ ]
                                    Not all additions
                  Application                         Application
                                    are counted anymore
40
Documenting Reuse
                                Framework
     Framework
                                 Set #add: [ ]
                                      #addAll: [#add:]
      Set #add: [ ]
          #addAll: [#add:]

                                     extension
                                       #incCount
                                     refinement
                                       #add: [super,+#incCount]


      CountingSet
                                 CountingSet
     #add: [super, #incCount]
     #incCount [ ]              #add: [super, #incCount]
                                #incCount [ ]
                  Application
                                             Application

41
Documenting Evolution
     Framework                                      Framework

      Set #add: [ ]                                  Set #add: [ ]
           #addAll: [#add:]   Evolution                   #addAll: [#add:]




     Framework                                      Framework

      Set #add: [ ]           coarsening             Set #add: [ ]
           #addAll: [#add:]                               #addAll: [ ]
                                #addAll: [-#add:]



42
Estimating Impact of Changes
Framework                                             Framework

     Set #add: [ ]                                     Set #add: [ ]
           #addAll: [#add:]     coarsening                  #addAll: [ ]
                                  #addAll: [-#add:]

          extension                                        extension
            #incCount                                        #incCount
          refinement                                       refinement
            #add: [super,+#incCount]                         #add: [super,+#incCount]



     CountingSet                                       CountingSet
     #add: [super, #incCount]                      #add: [super, #incCount]
     #incCount [ ]                                 #incCount [ ]
                                            #addAll: needs to be
                  Application               overridden too          Application

43
Overview
      Problems with reuse
      Problems with evolution
      What are reuse contracts?
      Reuse contracts at work
      Examining class hierarchies based on
      reuse contracts
      Reuse contract research
      Exercises: introduction to the browser
44
Extraction of Reuse Contracts

     Reuse contracts for
     inheritance can be
     extracted from
     Smalltalk code           reuse
     Each subclassing step operators
     is decomposed in a
                                class
     combination of
     maximum 6 different
     reuse operators

45
Too Much Extracted
     Information
      The extractor does not know which
      methods are important
      Interaction with a developer is required
      to strip implementation details




46
Inspecting Extracted
     Extensions




47
Inspecting Extracted
     Concretisations




48
Inspecting Extracted
     Refinements




49
Inspecting Extracted
     Coarsenings




50
Inspecting Extracted
     Cancellations




51
Spotting Bad Designs in a
     Class Hierarchy
      Look for design breaching reuse
      operators
      –– they indicate methods that do not respect
         the design as laid down by a superclass
      Examine what happens with the
      affected methods in reuse operators that
      are applied later on

52
Spotting Bad Designs: Example
     The Stream hierarchy is awkward
     wrt. the #next method.

                     1




               2


                         3

53
Impact of Bad Coding Style

      Bad coding style is troublesome for the
      extractor
      –– e.g. only super send, bad super send, ...
      This has driven us to make qualitative
      assessment of source code possible
      An analysis tool is integrated in our
      browser

54
Overview
      Problems with reuse
      Problems with evolution
      What are reuse contracts?
      Reuse contracts at work
      Examining class hierarchies based on
      reuse contracts
      Reuse contract research
      Exercises: introduction to the browser
55
Reuse Contract Research
     Reuse contracts have been applied to
     –– classes (inheritance)
     –– sets of interacting classes/components
     –– state diagrams
     Under investigation:
     ––   can reuse contracts describe design patterns?
     ––   generic reuse contracts
     ––   extraction of multi-class reuse contracts
     ––   software architectures and componentware
     ––   reuse contracts in a development environment
     ––   more documentation than interfaces and invocations
56
Design Pattern Example
     Client                    Component      graphics

                               #operation

              concretisation                refinement   operation [operation]
                                            extension

                                      Composite
                                                                    concretisation
                   Leaf              #operation
                                     #add:
               #operation
                                     #remove:
                                     #getChild:                   CompositeA
                                                                  #operation
                                                                  #add:
                                                                  #remove:
                                                                  #getChild:

57
Summary: Theory

     Reuse contracts formally document what
     a reuser can assume about a ““reusable
     component””
     Reuse operators formally document how
     a reusable component is actually reused
     Formal rules for change propagation
     enable automatic detection of evolution
     conflicts
58
Summary: Practice

      Reuse contracts for inheritance can be
      extracted
      –– examination of existing source code
      –– understanding the design
      –– human input is needed to filter out
         implementation details
      –– bad coding style may give rise to extraction
         problems

59
Overview
      Problems with reuse
      Problems with evolution
      What are reuse contracts?
      Reuse contracts at work
      Examining class hierarchies based on
      reuse contracts
      Reuse contract research
      Exercises: introduction to the browser
60
The Browser for the Exercises

     Home-made fully-functional browser
     Composed of reusable ““browser part
     components”” built with ApplFLab
     Can easily be         See ESUG’’96 Summer School
                           ““ApplFLab: Custom-made user
     extended with other interface components in VisualWorks””
     ““class view/editor
     components””


61
Enhanced Browser —— General

        Different views   Different views/tools


                                       Method selector
                                                                  Different views

     Class selector                    Different method editors



                                                         Method editor



62
Browser —— Reuse Contracts




63
Browser —— Code Analysis




64
Browser —— Clusters




65
Browser —— Metrics




66
Exercises
      Use the enhanced browser to
      investigate Smalltalk code
      –– Examine class hierarchies based on
         extracted reuse contracts
      –– Analyse the code to find methods that
         hinder reuse
      –– Explore the different tools
      File in your own Smalltalk classes/
      frameworks
67
Up-to-date Information




       http://progwww.vub.ac.be/prog/pools/rcs/

68

Mais conteúdo relacionado

Destaque

From Print Design to Web Design
From Print Design to Web DesignFrom Print Design to Web Design
From Print Design to Web DesignESUG
 
Diagnosis and semi-automatic correction of detected design inconsistencies in...
Diagnosis and semi-automatic correction of detected design inconsistencies in...Diagnosis and semi-automatic correction of detected design inconsistencies in...
Diagnosis and semi-automatic correction of detected design inconsistencies in...ESUG
 
Vancea vasile swarm intelligence
Vancea vasile   swarm intelligenceVancea vasile   swarm intelligence
Vancea vasile swarm intelligencevviper21
 
Swarm intelligence
Swarm intelligenceSwarm intelligence
Swarm intelligenceDiego Lopez
 
Software Reuse: Towards coding sanity
Software Reuse: Towards coding sanitySoftware Reuse: Towards coding sanity
Software Reuse: Towards coding sanityApostolos Kritikos
 
The Joy of Reuse
The Joy of ReuseThe Joy of Reuse
The Joy of ReuseJoe Gollner
 
Reusing your existing software on Android
Reusing your existing software on AndroidReusing your existing software on Android
Reusing your existing software on AndroidTetsuyuki Kobayashi
 
3. The Software Development Process - Implementation
3. The Software Development Process - Implementation3. The Software Development Process - Implementation
3. The Software Development Process - ImplementationForrester High School
 
Breaking Bad Content (Lavacon 2013 J Gollner)
Breaking Bad Content (Lavacon 2013 J Gollner)Breaking Bad Content (Lavacon 2013 J Gollner)
Breaking Bad Content (Lavacon 2013 J Gollner)Joe Gollner
 
Bifrost
BifrostBifrost
BifrostESUG
 
Retrobjects - Fun with C64 and NES
Retrobjects - Fun with C64 and NESRetrobjects - Fun with C64 and NES
Retrobjects - Fun with C64 and NESESUG
 
VASmalltalk, Today and Tomorrow
VASmalltalk, Today and TomorrowVASmalltalk, Today and Tomorrow
VASmalltalk, Today and TomorrowESUG
 
Smalltalk implementation of EXIL, a Component-based Programming Language
 Smalltalk implementation of EXIL, a Component-based Programming Language Smalltalk implementation of EXIL, a Component-based Programming Language
Smalltalk implementation of EXIL, a Component-based Programming LanguageESUG
 
seaBreeze 5.0
seaBreeze 5.0seaBreeze 5.0
seaBreeze 5.0ESUG
 
Glass 2.0
Glass 2.0Glass 2.0
Glass 2.0ESUG
 
Lingua portuguesa
Lingua portuguesaLingua portuguesa
Lingua portuguesalauxentania
 
Serenata schubert (1)
Serenata schubert (1)Serenata schubert (1)
Serenata schubert (1)filipj2000
 

Destaque (20)

From Print Design to Web Design
From Print Design to Web DesignFrom Print Design to Web Design
From Print Design to Web Design
 
Diagnosis and semi-automatic correction of detected design inconsistencies in...
Diagnosis and semi-automatic correction of detected design inconsistencies in...Diagnosis and semi-automatic correction of detected design inconsistencies in...
Diagnosis and semi-automatic correction of detected design inconsistencies in...
 
Vancea vasile swarm intelligence
Vancea vasile   swarm intelligenceVancea vasile   swarm intelligence
Vancea vasile swarm intelligence
 
Swarm intelligence
Swarm intelligenceSwarm intelligence
Swarm intelligence
 
Software Reuse: Towards coding sanity
Software Reuse: Towards coding sanitySoftware Reuse: Towards coding sanity
Software Reuse: Towards coding sanity
 
The Joy of Reuse
The Joy of ReuseThe Joy of Reuse
The Joy of Reuse
 
Reusing your existing software on Android
Reusing your existing software on AndroidReusing your existing software on Android
Reusing your existing software on Android
 
3. The Software Development Process - Implementation
3. The Software Development Process - Implementation3. The Software Development Process - Implementation
3. The Software Development Process - Implementation
 
Breaking Bad Content (Lavacon 2013 J Gollner)
Breaking Bad Content (Lavacon 2013 J Gollner)Breaking Bad Content (Lavacon 2013 J Gollner)
Breaking Bad Content (Lavacon 2013 J Gollner)
 
Ai swarm intelligence
Ai   swarm intelligenceAi   swarm intelligence
Ai swarm intelligence
 
Bifrost
BifrostBifrost
Bifrost
 
Retrobjects - Fun with C64 and NES
Retrobjects - Fun with C64 and NESRetrobjects - Fun with C64 and NES
Retrobjects - Fun with C64 and NES
 
VASmalltalk, Today and Tomorrow
VASmalltalk, Today and TomorrowVASmalltalk, Today and Tomorrow
VASmalltalk, Today and Tomorrow
 
Smalltalk implementation of EXIL, a Component-based Programming Language
 Smalltalk implementation of EXIL, a Component-based Programming Language Smalltalk implementation of EXIL, a Component-based Programming Language
Smalltalk implementation of EXIL, a Component-based Programming Language
 
seaBreeze 5.0
seaBreeze 5.0seaBreeze 5.0
seaBreeze 5.0
 
Glass 2.0
Glass 2.0Glass 2.0
Glass 2.0
 
Panasonic - GHV Antriebstechnik 3Series Drestrommotoren
Panasonic - GHV Antriebstechnik 3Series DrestrommotorenPanasonic - GHV Antriebstechnik 3Series Drestrommotoren
Panasonic - GHV Antriebstechnik 3Series Drestrommotoren
 
Lingua portuguesa
Lingua portuguesaLingua portuguesa
Lingua portuguesa
 
Serenata schubert (1)
Serenata schubert (1)Serenata schubert (1)
Serenata schubert (1)
 
Concurso outubro
Concurso outubroConcurso outubro
Concurso outubro
 

Semelhante a Reuse Contracts

Domain Driven Design Pattern Summaries
Domain Driven Design Pattern SummariesDomain Driven Design Pattern Summaries
Domain Driven Design Pattern SummariesGlen Wilson
 
Design Patterns Course
Design Patterns CourseDesign Patterns Course
Design Patterns CourseAhmed Soliman
 
From programming to software engineering: ICSE keynote slides available
From programming to software engineering: ICSE keynote slides availableFrom programming to software engineering: ICSE keynote slides available
From programming to software engineering: ICSE keynote slides availableCelso Martins
 
B vb script11
B vb script11B vb script11
B vb script11oakhrd
 
07 iec t1_s1_oo_ps_session_10
07 iec t1_s1_oo_ps_session_1007 iec t1_s1_oo_ps_session_10
07 iec t1_s1_oo_ps_session_10Niit Care
 
OO Design and Design Patterns in C++
OO Design and Design Patterns in C++ OO Design and Design Patterns in C++
OO Design and Design Patterns in C++ Ganesh Samarthyam
 
OOP interview questions & answers.
OOP interview questions & answers.OOP interview questions & answers.
OOP interview questions & answers.Questpond
 
Intro to c# (vs. objective c and java)
Intro to c# (vs. objective c and java)Intro to c# (vs. objective c and java)
Intro to c# (vs. objective c and java)Wes Yanaga
 
Software Reuse and Object-Oriented Programming
Software Reuse and Object-Oriented ProgrammingSoftware Reuse and Object-Oriented Programming
Software Reuse and Object-Oriented Programmingkim.mens
 
GoF Design patterns I: Introduction + Structural Patterns
GoF Design patterns I:   Introduction + Structural PatternsGoF Design patterns I:   Introduction + Structural Patterns
GoF Design patterns I: Introduction + Structural PatternsSameh Deabes
 
Chapter 5: Names, Bindings and Scopes (review Questions and Problem Set)
Chapter 5: Names, Bindings and Scopes (review Questions and Problem Set)Chapter 5: Names, Bindings and Scopes (review Questions and Problem Set)
Chapter 5: Names, Bindings and Scopes (review Questions and Problem Set)Farwa Ansari
 
EEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answerEEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answerJeba Moses
 
PROGRAMMING LANGUAGES
PROGRAMMING LANGUAGESPROGRAMMING LANGUAGES
PROGRAMMING LANGUAGESABHINAV SINGH
 
Top 20 c# interview Question and answers
Top 20 c# interview Question and answersTop 20 c# interview Question and answers
Top 20 c# interview Question and answersw3asp dotnet
 

Semelhante a Reuse Contracts (20)

Domain Driven Design Pattern Summaries
Domain Driven Design Pattern SummariesDomain Driven Design Pattern Summaries
Domain Driven Design Pattern Summaries
 
Inheritance
InheritanceInheritance
Inheritance
 
Design Patterns Course
Design Patterns CourseDesign Patterns Course
Design Patterns Course
 
From programming to software engineering: ICSE keynote slides available
From programming to software engineering: ICSE keynote slides availableFrom programming to software engineering: ICSE keynote slides available
From programming to software engineering: ICSE keynote slides available
 
L03 Software Design
L03 Software DesignL03 Software Design
L03 Software Design
 
B vb script11
B vb script11B vb script11
B vb script11
 
07 iec t1_s1_oo_ps_session_10
07 iec t1_s1_oo_ps_session_1007 iec t1_s1_oo_ps_session_10
07 iec t1_s1_oo_ps_session_10
 
OO Design and Design Patterns in C++
OO Design and Design Patterns in C++ OO Design and Design Patterns in C++
OO Design and Design Patterns in C++
 
C++ interview question
C++ interview questionC++ interview question
C++ interview question
 
OOP interview questions & answers.
OOP interview questions & answers.OOP interview questions & answers.
OOP interview questions & answers.
 
Intro to c# (vs. objective c and java)
Intro to c# (vs. objective c and java)Intro to c# (vs. objective c and java)
Intro to c# (vs. objective c and java)
 
04 inheritance
04 inheritance04 inheritance
04 inheritance
 
Software Reuse and Object-Oriented Programming
Software Reuse and Object-Oriented ProgrammingSoftware Reuse and Object-Oriented Programming
Software Reuse and Object-Oriented Programming
 
GoF Design patterns I: Introduction + Structural Patterns
GoF Design patterns I:   Introduction + Structural PatternsGoF Design patterns I:   Introduction + Structural Patterns
GoF Design patterns I: Introduction + Structural Patterns
 
Chapter 5: Names, Bindings and Scopes (review Questions and Problem Set)
Chapter 5: Names, Bindings and Scopes (review Questions and Problem Set)Chapter 5: Names, Bindings and Scopes (review Questions and Problem Set)
Chapter 5: Names, Bindings and Scopes (review Questions and Problem Set)
 
EEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answerEEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answer
 
PROGRAMMING LANGUAGES
PROGRAMMING LANGUAGESPROGRAMMING LANGUAGES
PROGRAMMING LANGUAGES
 
Top 20 c# interview Question and answers
Top 20 c# interview Question and answersTop 20 c# interview Question and answers
Top 20 c# interview Question and answers
 
Unit-V.pptx
Unit-V.pptxUnit-V.pptx
Unit-V.pptx
 
Solid
SolidSolid
Solid
 

Mais de ESUG

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingESUG
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in PharoESUG
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapESUG
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoESUG
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...ESUG
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsESUG
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6ESUG
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationESUG
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingESUG
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesESUG
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportESUG
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsESUG
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector TuningESUG
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseESUG
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FutureESUG
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the DebuggerESUG
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing ScoreESUG
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptESUG
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocESUG
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsESUG
 

Mais de ESUG (20)

Workshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programmingWorkshop: Identifying concept inventories in agile programming
Workshop: Identifying concept inventories in agile programming
 
Technical documentation support in Pharo
Technical documentation support in PharoTechnical documentation support in Pharo
Technical documentation support in Pharo
 
The Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and RoadmapThe Pharo Debugger and Debugging tools: Advances and Roadmap
The Pharo Debugger and Debugging tools: Advances and Roadmap
 
Sequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in PharoSequence: Pipeline modelling in Pharo
Sequence: Pipeline modelling in Pharo
 
Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...Migration process from monolithic to micro frontend architecture in mobile ap...
Migration process from monolithic to micro frontend architecture in mobile ap...
 
Analyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early resultsAnalyzing Dart Language with Pharo: Report and early results
Analyzing Dart Language with Pharo: Report and early results
 
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
Transpiling Pharo Classes to JS ECMAScript 5 versus ECMAScript 6
 
A Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test GenerationA Unit Test Metamodel for Test Generation
A Unit Test Metamodel for Test Generation
 
Creating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic ProgrammingCreating Unit Tests Using Genetic Programming
Creating Unit Tests Using Genetic Programming
 
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution ModesThreaded-Execution and CPS Provide Smooth Switching Between Execution Modes
Threaded-Execution and CPS Provide Smooth Switching Between Execution Modes
 
Exploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience ReportExploring GitHub Actions through EGAD: An Experience Report
Exploring GitHub Actions through EGAD: An Experience Report
 
Pharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIsPharo: a reflective language A first systematic analysis of reflective APIs
Pharo: a reflective language A first systematic analysis of reflective APIs
 
Garbage Collector Tuning
Garbage Collector TuningGarbage Collector Tuning
Garbage Collector Tuning
 
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame CaseImproving Performance Through Object Lifetime Profiling: the DataFrame Case
Improving Performance Through Object Lifetime Profiling: the DataFrame Case
 
Pharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and FuturePharo DataFrame: Past, Present, and Future
Pharo DataFrame: Past, Present, and Future
 
thisContext in the Debugger
thisContext in the DebuggerthisContext in the Debugger
thisContext in the Debugger
 
Websockets for Fencing Score
Websockets for Fencing ScoreWebsockets for Fencing Score
Websockets for Fencing Score
 
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScriptShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
ShowUs: PharoJS.org Develop in Pharo, Run on JavaScript
 
Advanced Object- Oriented Design Mooc
Advanced Object- Oriented Design MoocAdvanced Object- Oriented Design Mooc
Advanced Object- Oriented Design Mooc
 
A New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and TransformationsA New Architecture Reconciling Refactorings and Transformations
A New Architecture Reconciling Refactorings and Transformations
 

Último

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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
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
 
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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 

Último (20)

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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
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
 
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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

Reuse Contracts

  • 1. Reuse Contracts as a basis for investigating reusability of Smalltalk code Koen De Hondt Programming Technology Lab Computer Science Department Vrije Universiteit Brussel kdehondt@vub.ac.be http:/progwww.vub.ac.be/ 1
  • 2. Overview Problems with reuse Problems with evolution What are reuse contracts? Reuse contracts at work Examining class hierarchies based on reuse contracts Reuse contract research Exercises: introduction to the browser 2
  • 3. How do You Reuse a Class? Cloning (copy and paste) Inheritance / method overriding Composition / delegation 3
  • 4. Reuse by Cloning Reused ““components”” are not easily adaptable –– no support is provided for adaptation/reuse No relation between original and result –– difficult to maintain since bug fixes and upgrades are not propagated to the derived application (proliferation of versions) ! This kind of reuse should be avoided 4
  • 5. Reuse by Inheritance Class A How do you determine –– what to reuse (inherit)? Subclass B –– what to adapt (override)? –– what to write from scratch? Subclass C ? Subclass D 5
  • 6. Example: Make a Subclass of Set Framework What to override? Set #add: –– #add: if #addAll: uses #add: #addAll: –– #add & addAll: if #addAll: does not use #add: CountingSet A CountingSet is a Set that Application counts all added elements 6
  • 7. Reuse by Composition How do you determine –– what to reuse (what to compose, what to delegate)? –– what to adapt (how to compose)? –– what to write from scratch? Class B Class A ? Class C 7
  • 8. Reusing a Class is Hard Current OOA/OOD notations do not provide enough information to reuse a class Usually, developers do not document how a class can be reused, they only document what each method does If a class comment contains reuse information, it usually has the form of a cookbook Reusers are compelled to inspect the source code 8
  • 9. Inspecting the Source Code To reuse a class: –– inspect the class –– inspect all its superclasses –– inspect all the classes it co-operates with Source code inspection is error-prone If source code inspection doesn’’t work: talk to the developer (i.e. the expert)! 9
  • 10. What are You Looking for? Self sends Super sends Reusers need the Abstract methods specialisation interface Template methods Default methods Methods that are overridden frequently Methods that are part of a design pattern Co-operation with other objects/classes ... 10
  • 11. Self Sends are Important Self sends & template methods & abstract methods reify the design of a class Method decomposition –– distinguish ““core”” methods from ““peripheral”” methods Using self sends = planning for reuse –– fine-grained overriding of methods 11
  • 12. Self Sends: Planning for Reuse ApplicationModel in VisualWorks 2.5 can be reused with other builders openInterface: aSymbol builder := self builderClass new. ... “a lot of expressions here” ... same external interface (#builderClass is private) ApplicationModel in VisualWorks 2.0 openInterface: aSymbol builder := UIBuilder new. cannot be reused with other builders ... without overriding all methods that “a lot of expressions here” refer to UIBuilder ... 12
  • 13. Co-operation with Other Objects/Classes is Important Delegation of responsibilities principle Using delegation= planning for reuse –– a system can easily be extended by adding new classes –– objects with ““the same interface”” can be substituted for each other 13
  • 14. Delegation: Planning for Reuse Menu in VisualWorks 2.0 can be reused for Menu MenuItem different menu items items same external behaviour same interface PopUpMenu in VisualWorks 1.0 for instance creation PopUpMenu Strings ! labels cannot be reused for different menu items 14
  • 15. Overview Problems with reuse Problems with evolution What are reuse contracts? Reuse contracts at work Examining class hierarchies based on reuse contracts Reuse contract research Exercises: introduction to the browser 15
  • 16. Evolution is Important Iterative development –– a framework is never finished Changing requirements –– functional: user requirements –– non-functional: maintainability, adaptibility, reusability, customisability, ... 16
  • 17. What to do When the Framework Changes? Framework 1.0 Framework 2.0 X X Evolution ? Y Y Application Application 17
  • 18. Example Evolution Conflict (1) Framework 1.0 Framework 2.0 d) te en #m do d m X X ot en #m cu (n lf s Evolution #p se #p Y #p Y Method capture i instance of i Application subclass of Application 18
  • 19. Example Evolution Conflict (2) Framework 1.0 Framework 2.0 #m #m X X #p #p Evolution #p #p #q Y #q Y self send instance of Inconsistent methods i Application i Application subclass of 19
  • 20. More Evolution Conflicts Interface conflicts –– the name of a reused method/class has been changed –– a method that was added by a reuser has been introduced by the new version of the framework Unanticipated recursion –– a method invokes another one in the application while the new version of the framework introduces an invocation of the first by the latter 20
  • 21. Spotting Evolution Problems Unless the changes to the framework are well-documented (informally), the application developer is condemned to perform code inspection to determine what has changed Often evolution conflicts are not spotted until the application is running based on the new version of the framework 21
  • 22. What are the Challenges? Supporting reuse –– what can be reused, what must be adapted, and what must be built from scratch ? –– formal documentation on how classes are reused Supporting evolution –– change propagation Support for estimates/testing/metrics –– feasibility of reusing a class –– the cost of ““upgrading”” the class repository 22
  • 23. Overview Problems with reuse Problems with evolution What are reuse contracts? Reuse contracts at work Examining class hierarchies based on reuse contracts Reuse contract research Exercises: introduction to the browser 23
  • 24. Reuse Contracts Are contracts between the framework developer and the application developer State what assumptions can be made about reusable components State how components are actually reused 24
  • 25. Reuse Contract Notation Notation based on OMT (UML) Methods are annotated with specialisation clauses to make the specialisation interface explicit ““Reuse operators””, or ““modifiers””, lay down how reuse is achieved 25
  • 26. Reuse Contracts for Inheritance specialisation clause Enhance the interface of a class abstract method with specialisation clauses Collection Identify what changes are made #collect: [#do:] when a class is subclassed: #do: –– concretisation/abstraction #select: [#do:] –– extension/cancellation concretisation –– refinement/coarsening #do: Specialisation clauses may contain Set names of methods invoked #collect: [#do:] through self sends, and ““super”” #do: reuse operator #select: [#do:] 26
  • 27. Reuse Operator: Concretisation Collection Makes abstract methods #collect: [#do:] concrete #do: #select: [#do:] Does not change the specialisation clause of concretisation #do: the concretised methods Design preserving Set #collect: [#do:] Inverse = abstraction #do: #select: [#do:] 27
  • 28. Reuse Operator: Abstraction View #preferredBounds [ ] Makes a concrete method abstract SimpleView Design breaching #preferredBounds [ ] Inverse = concretisation BasicButtonView #preferredBounds [ ] abstraction #preferredBounds LabeledButtonView #preferredBounds [ ] 28
  • 29. Reuse Operator: Extension Typically performed by an application developer to add Collection application specific behaviour ... Adds new methods to the extension interface of a class #- #grow Design preserving Set Inverse = cancellation ... #- [ ] #grow [ ] 29
  • 30. Reuse Operator: Cancellation Collection Typically performed by an ... #add: [ ] application developer to #remove:ifAbsent: [ ] remove behaviour cancellation #remove:ifAbsent: Removes methods from the interface of a class SequenceableCollection ... Design breaching #add: [ ] Inverse = extension cancellation #add: ArrayedCollection ... 30
  • 31. Reuse Operator: Refinement Adds elements to the Object specialisation clause of a method #postCopy [ ] Used to e.g. : refinement #postCopy [super, –– reduce redundancy + #breakDependents] –– specialise the behaviour of Model an existing method with an #postCopy existing behaviour [super, #breakDependents] Design preserving Inverse = coarsening 31
  • 32. Reuse Operator: Coarsening Removes elements from Collection the specialisation clause of a method #size [#do:] Used to e.g.: coarsening #size [- #do:] –– optimize performance Design breaching Set Inverse = refinement #size [ ] 32
  • 33. Reuse Operators Make a distinction between different kinds of inheritance State how a class is derived from its superclass Are orthogonal basic operators Usually, one subclassing step is a combination of several reuse operators 33
  • 34. Frequently Used Combinations of Reuse Operators Extension & refinement Coarsening & cancellation Concretisation & refinement Concretisation & extension & refinement Coarsening & refinement = redefinition Coarsening & extension & refinement = factorization 34
  • 35. Multi-Class Reuse Contracts (in short) Co-operating classes are put in one reuse contract; these classes are called ““participants”” Interfaces of classes as in reuse contracts for inheritance Specialisation clauses are extended with names of methods invoked on other classes Reuse operators identify what changes are made to a whole contract 35
  • 36. Reuse Contract Notation Interface opening specialisation clauses participants #openInterface: UIBuilder ApplicationModel [#source:, #add:, #source: #openWithExtent:] #add: #openInterface: builder #openWithExtent: self #openInterface: [#model:, #displayPendingInvalidation] #openInterface: [#preBuildWith:, ApplicationWindow #hookupWindow:spec:builder:, #model: #postBuildWith:, #displayPendingInvalidation #postOpenWith:] 36
  • 37. Overview Problems with reuse Problems with evolution What are reuse contracts? Reuse contracts at work Examining class hierarchies based on reuse contracts Reuse contract research Exercises: introduction to the browser 37
  • 38. Reuse Contracts at Work The formal nature of reuse contracts enables their use in a development environment –– code generation from reuse contracts –– impact analysis when a framework changes (assessing evolution conflicts) –– effort estimation for framework customisation –– extraction from source code 38
  • 39. Estimating Reuse Framework Framework Set #add: Set #add: [ ] #addAll: #addAll: [#add:] ? What to override? CountingSet CountingSet #add: [super, #incCount] #incCount [ ] Application Application 39
  • 40. Evolution Framework Framework Set #add: [ ] Set #add: [ ] #addAll: [#add:] Evolution #addAll: [#add:] CountingSet CountingSet #add: [super, #incCount] #add: [super, #incCount] #incCount [ ] #incCount [ ] Not all additions Application Application are counted anymore 40
  • 41. Documenting Reuse Framework Framework Set #add: [ ] #addAll: [#add:] Set #add: [ ] #addAll: [#add:] extension #incCount refinement #add: [super,+#incCount] CountingSet CountingSet #add: [super, #incCount] #incCount [ ] #add: [super, #incCount] #incCount [ ] Application Application 41
  • 42. Documenting Evolution Framework Framework Set #add: [ ] Set #add: [ ] #addAll: [#add:] Evolution #addAll: [#add:] Framework Framework Set #add: [ ] coarsening Set #add: [ ] #addAll: [#add:] #addAll: [ ] #addAll: [-#add:] 42
  • 43. Estimating Impact of Changes Framework Framework Set #add: [ ] Set #add: [ ] #addAll: [#add:] coarsening #addAll: [ ] #addAll: [-#add:] extension extension #incCount #incCount refinement refinement #add: [super,+#incCount] #add: [super,+#incCount] CountingSet CountingSet #add: [super, #incCount] #add: [super, #incCount] #incCount [ ] #incCount [ ] #addAll: needs to be Application overridden too Application 43
  • 44. Overview Problems with reuse Problems with evolution What are reuse contracts? Reuse contracts at work Examining class hierarchies based on reuse contracts Reuse contract research Exercises: introduction to the browser 44
  • 45. Extraction of Reuse Contracts Reuse contracts for inheritance can be extracted from Smalltalk code reuse Each subclassing step operators is decomposed in a class combination of maximum 6 different reuse operators 45
  • 46. Too Much Extracted Information The extractor does not know which methods are important Interaction with a developer is required to strip implementation details 46
  • 47. Inspecting Extracted Extensions 47
  • 48. Inspecting Extracted Concretisations 48
  • 49. Inspecting Extracted Refinements 49
  • 50. Inspecting Extracted Coarsenings 50
  • 51. Inspecting Extracted Cancellations 51
  • 52. Spotting Bad Designs in a Class Hierarchy Look for design breaching reuse operators –– they indicate methods that do not respect the design as laid down by a superclass Examine what happens with the affected methods in reuse operators that are applied later on 52
  • 53. Spotting Bad Designs: Example The Stream hierarchy is awkward wrt. the #next method. 1 2 3 53
  • 54. Impact of Bad Coding Style Bad coding style is troublesome for the extractor –– e.g. only super send, bad super send, ... This has driven us to make qualitative assessment of source code possible An analysis tool is integrated in our browser 54
  • 55. Overview Problems with reuse Problems with evolution What are reuse contracts? Reuse contracts at work Examining class hierarchies based on reuse contracts Reuse contract research Exercises: introduction to the browser 55
  • 56. Reuse Contract Research Reuse contracts have been applied to –– classes (inheritance) –– sets of interacting classes/components –– state diagrams Under investigation: –– can reuse contracts describe design patterns? –– generic reuse contracts –– extraction of multi-class reuse contracts –– software architectures and componentware –– reuse contracts in a development environment –– more documentation than interfaces and invocations 56
  • 57. Design Pattern Example Client Component graphics #operation concretisation refinement operation [operation] extension Composite concretisation Leaf #operation #add: #operation #remove: #getChild: CompositeA #operation #add: #remove: #getChild: 57
  • 58. Summary: Theory Reuse contracts formally document what a reuser can assume about a ““reusable component”” Reuse operators formally document how a reusable component is actually reused Formal rules for change propagation enable automatic detection of evolution conflicts 58
  • 59. Summary: Practice Reuse contracts for inheritance can be extracted –– examination of existing source code –– understanding the design –– human input is needed to filter out implementation details –– bad coding style may give rise to extraction problems 59
  • 60. Overview Problems with reuse Problems with evolution What are reuse contracts? Reuse contracts at work Examining class hierarchies based on reuse contracts Reuse contract research Exercises: introduction to the browser 60
  • 61. The Browser for the Exercises Home-made fully-functional browser Composed of reusable ““browser part components”” built with ApplFLab Can easily be See ESUG’’96 Summer School ““ApplFLab: Custom-made user extended with other interface components in VisualWorks”” ““class view/editor components”” 61
  • 62. Enhanced Browser —— General Different views Different views/tools Method selector Different views Class selector Different method editors Method editor 62
  • 63. Browser —— Reuse Contracts 63
  • 64. Browser —— Code Analysis 64
  • 67. Exercises Use the enhanced browser to investigate Smalltalk code –– Examine class hierarchies based on extracted reuse contracts –– Analyse the code to find methods that hinder reuse –– Explore the different tools File in your own Smalltalk classes/ frameworks 67
  • 68. Up-to-date Information http://progwww.vub.ac.be/prog/pools/rcs/ 68