SlideShare a Scribd company logo
1 of 21
Classboxes: A Minimal Module Model
  Supporting Local Class Extension

   Alexandre Bergel, Stéphane Ducasse,
             and Roel Wuyts
       Software Composition Group
      University of Bern (Switzerland)
           bergel@iam.unibe.ch
Outline
1.   Class extension and Package
2.   Supporting Unanticipated Changes
3.   The Classbox Model
4.   Implementation
5.   Conclusion
6.   Future Work


                                        1
Class Extension

• Languages such as CLOS or Smalltalk provide a
  mechanism of Class Extension

• A Class Extension is the ability to add or redefine
  methods on a class after its creation



                                                2
Class Extension: A powerful Mechanism
Visitor Example:
BlackPackage
              Opr



    Add             Mult



                                   3
Class Extension: A powerful Mechanism
Visitor Example:
BlackPackage                         BluePackage
                  Opr
           acceptVisitor()               Visitor
                                         doAdd()
     Add                Mult             doMult()
acceptVisitor()    acceptVisitor()


                                                    4
Subclassing does not Solve it

            Opr                        Parser
                                       parse()
   Add            Times
                                    …
                                    Add.new()
    Add’             Times’         …
acceptVisitor()   acceptVisitor()

Subclasses are not referenced by the tree constructor
                                                 5
In Smalltalk
• Class extensions are global
• Any application can modify any class in the system

Consequences
   – Conflicts may arise (e.g., two applications may add the
     same method)
   – Robustness aspect (e.g., an application may redefine a
     critical method)

                                                     6
Supporting Unanticipated Changes:
                Adaptation
• Java, Modula-3,…have package/modules but no Class
  Extension
• Smalltalk has Class Extension but no package/module

      fi Class Extension + Module ?

• How to control class extensions?
• How to apply a set of unanticipated changes without
  breaking existing clients?

                                                    7
Classbox Model Definition
• The Classbox Model is a minimal module model
  supporting local class extension
• A Classbox
   –   Is a unit of scoping (i.e., it acts as a namespace)
   –   Can define classes
   –   Can import class definitions from other classboxes
   –   Can define methods on classes in the scope: class extensions
• Classes and methods always belong to exactly one
  classbox
• Visibility of each element in a classbox is bound to this
  classbox

                                                             8
Classbox Model: Avoiding Conflict
  By having class           TextClassbox                   import
  extensions local to a
                            String
  classbox, conflicts are
  avoided                                  URLClassbox
                                                URL
WWWClassbox
                  WWWURL                          String
                                                  asUrl
                  String
WWWURL.new()      asUrl
…                                          URL.new()
                                           …

                                                       9
Classbox Model: Import and Visibility
 Extended classes can be          TextClassbox              import
 used by classboxes
                                   String
 through the import
 relationship                                    URLClassbox
                                                   URL
RedClassbox
                                                   String
…                                                  asUrl
url = “http://www.iam.unibe.ch/~scg”.asUrl()




                                                     10
Classbox Model: Classbox as a Sandbox
All the changes are local, so       CollectionClassbox           import
redefinition of a critical method
is limited to the Classbox          OrderedCollection
providing the extension              do()

                                                 GreenClassbox
                                              OrderedCollection
                                               do()
                      aCollection.do(…)
                                                        C
                  C.new().foo()                 foo()

                                                            11
Classbox Model: Flattening Property
Any expression executed in a       CollectionClassbox         import
classbox will be evaluated as if   OrderedCollection
the whole classbox graph were       do()
collapsed to a single classbox.     copy() 2

                                                GreenClassbox
      self.do(element.copy())                OrderedCollection
                                              do() 3
                     aCollection.copy(…)
                                                     C
                  C.new().bar()                bar() 1

                                                         12
From within the Green Classbox




                                       GreenClassbox
self.do(element.copy())             OrderedCollection
                                     do() 3
                                     copy() 2
              aCollection.copy(…)
                                           C
          C.new().bar()              bar() 1

                                             13
Implementation
• Implemented in Squeak, an open-source Smalltalk
• To avoid excessive memory costs:
  – modify the VM
• New method lookup taking some extra parameters
  into account such as:
  – Original classbox (referring the classbox where the
    initial expression is executed)
  – Collection of all the traversed classboxes
                                                   14
Lookup: Imports before Inheritance

CollectionClassbox      ImprovedClassbox     PinkClassbox
 OrderedCollection       OrderedCollection            Pink
 do()                    do()                 foo()
 copy()
                                             aSortedCollection.copy()

 SortedCollection        SortedCollection    SortedCollection



                                              Pink.new().foo()
Lookup of the copy() method
                                                        15
Lookup: Imports before Inheritance

CollectionClassbox      ImprovedClassbox     PinkClassbox
 OrderedCollection       OrderedCollection            Pink
 do()                    do()                 foo()
 copy() 6                         5                     4
                                             aSortedCollection.copy()

 SortedCollection        SortedCollection    SortedCollection
          3                       2                     1
                                              Pink.new().foo()
Lookup of the copy() method
                                                        16
Lookup: Imports before Inheritance
The copy() method invokes do() one
CollectionClassbox       ImprovedClassbox           PinkClassbox
 OrderedCollection         OrderedCollection        PinkClass
 do()                      do()                     foo()
 copy()                              5                         4
                                                    aSortedCollection.copy()

 SortedCollection          SortedCollection         SortedCollection
           3                         2                         1

  Without any drastic optimization, a system is 60% slower
                                                               17
Conclusion
• Definition of a module system for controlling class
  extensions:
   – Method addition and replacement are only visible in the
     module that defines them
   – Control the visibility
   – Support for unanticipated evolution
• New method lookup
   – This has a price: slow performance with the current
     implementation

                                                    18
Future Work
• Allow aliasing, when importing

• Refined visibility control (allowing an extension to be
  global: evolution of a classbox)

• Add multiple Classbox interfaces (clients may see a
  classbox under different views)

• Formalization to specify the flattening property

                                                       19
Contact Information


• Alexandre Bergel (bergel@iam.unibe.ch)

• Website:
  – http://www.iam.unibe.ch/~scg/Research/Classboxes/index.html




                                                        20

More Related Content

What's hot

The Ring programming language version 1.4.1 book - Part 10 of 31
The Ring programming language version 1.4.1 book - Part 10 of 31The Ring programming language version 1.4.1 book - Part 10 of 31
The Ring programming language version 1.4.1 book - Part 10 of 31Mahmoud Samir Fayed
 
Java OOP Programming language (Part 8) - Java Database JDBC
Java OOP Programming language (Part 8) - Java Database JDBCJava OOP Programming language (Part 8) - Java Database JDBC
Java OOP Programming language (Part 8) - Java Database JDBCOUM SAOKOSAL
 
The Ring programming language version 1.4.1 book - Part 9 of 31
The Ring programming language version 1.4.1 book - Part 9 of 31The Ring programming language version 1.4.1 book - Part 9 of 31
The Ring programming language version 1.4.1 book - Part 9 of 31Mahmoud Samir Fayed
 
Collections Framework
Collections FrameworkCollections Framework
Collections FrameworkSunil OS
 
JDK1.7 features
JDK1.7 featuresJDK1.7 features
JDK1.7 featuresindia_mani
 
Java OOP Programming language (Part 4) - Collection
Java OOP Programming language (Part 4) - CollectionJava OOP Programming language (Part 4) - Collection
Java OOP Programming language (Part 4) - CollectionOUM SAOKOSAL
 
The Ring programming language version 1.6 book - Part 36 of 189
The Ring programming language version 1.6 book - Part 36 of 189The Ring programming language version 1.6 book - Part 36 of 189
The Ring programming language version 1.6 book - Part 36 of 189Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 39 of 202
The Ring programming language version 1.8 book - Part 39 of 202The Ring programming language version 1.8 book - Part 39 of 202
The Ring programming language version 1.8 book - Part 39 of 202Mahmoud Samir Fayed
 
Clojure Intro
Clojure IntroClojure Intro
Clojure Introthnetos
 
C h 04 oop_inheritance
C h 04 oop_inheritanceC h 04 oop_inheritance
C h 04 oop_inheritanceshatha00
 
The Ring programming language version 1.7 book - Part 29 of 196
The Ring programming language version 1.7 book - Part 29 of 196The Ring programming language version 1.7 book - Part 29 of 196
The Ring programming language version 1.7 book - Part 29 of 196Mahmoud Samir Fayed
 
From Java to Parellel Clojure - Clojure South 2019
From Java to Parellel Clojure - Clojure South 2019From Java to Parellel Clojure - Clojure South 2019
From Java to Parellel Clojure - Clojure South 2019Leonardo Borges
 
XQuery Extensions
XQuery ExtensionsXQuery Extensions
XQuery ExtensionsAaron Buma
 
Javascript foundations: Classes and `this`
Javascript foundations: Classes and `this`Javascript foundations: Classes and `this`
Javascript foundations: Classes and `this`John Hunter
 

What's hot (20)

Chapter ii(oop)
Chapter ii(oop)Chapter ii(oop)
Chapter ii(oop)
 
The Ring programming language version 1.4.1 book - Part 10 of 31
The Ring programming language version 1.4.1 book - Part 10 of 31The Ring programming language version 1.4.1 book - Part 10 of 31
The Ring programming language version 1.4.1 book - Part 10 of 31
 
Java
JavaJava
Java
 
Java OOP Programming language (Part 8) - Java Database JDBC
Java OOP Programming language (Part 8) - Java Database JDBCJava OOP Programming language (Part 8) - Java Database JDBC
Java OOP Programming language (Part 8) - Java Database JDBC
 
The Ring programming language version 1.4.1 book - Part 9 of 31
The Ring programming language version 1.4.1 book - Part 9 of 31The Ring programming language version 1.4.1 book - Part 9 of 31
The Ring programming language version 1.4.1 book - Part 9 of 31
 
4 gouping object
4 gouping object4 gouping object
4 gouping object
 
Collections Framework
Collections FrameworkCollections Framework
Collections Framework
 
JDK1.7 features
JDK1.7 featuresJDK1.7 features
JDK1.7 features
 
Java OOP Programming language (Part 4) - Collection
Java OOP Programming language (Part 4) - CollectionJava OOP Programming language (Part 4) - Collection
Java OOP Programming language (Part 4) - Collection
 
The Ring programming language version 1.6 book - Part 36 of 189
The Ring programming language version 1.6 book - Part 36 of 189The Ring programming language version 1.6 book - Part 36 of 189
The Ring programming language version 1.6 book - Part 36 of 189
 
The Ring programming language version 1.8 book - Part 39 of 202
The Ring programming language version 1.8 book - Part 39 of 202The Ring programming language version 1.8 book - Part 39 of 202
The Ring programming language version 1.8 book - Part 39 of 202
 
Python lec5
Python lec5Python lec5
Python lec5
 
Clojure Intro
Clojure IntroClojure Intro
Clojure Intro
 
C h 04 oop_inheritance
C h 04 oop_inheritanceC h 04 oop_inheritance
C h 04 oop_inheritance
 
Python lec4
Python lec4Python lec4
Python lec4
 
The Ring programming language version 1.7 book - Part 29 of 196
The Ring programming language version 1.7 book - Part 29 of 196The Ring programming language version 1.7 book - Part 29 of 196
The Ring programming language version 1.7 book - Part 29 of 196
 
Inheritance
InheritanceInheritance
Inheritance
 
From Java to Parellel Clojure - Clojure South 2019
From Java to Parellel Clojure - Clojure South 2019From Java to Parellel Clojure - Clojure South 2019
From Java to Parellel Clojure - Clojure South 2019
 
XQuery Extensions
XQuery ExtensionsXQuery Extensions
XQuery Extensions
 
Javascript foundations: Classes and `this`
Javascript foundations: Classes and `this`Javascript foundations: Classes and `this`
Javascript foundations: Classes and `this`
 

Similar to Classboxes: A Minimal Module Model Supporting Local Class Extension

Feltman collections
Feltman collectionsFeltman collections
Feltman collectionsMike Feltman
 
Spock: Test Well and Prosper
Spock: Test Well and ProsperSpock: Test Well and Prosper
Spock: Test Well and ProsperKen Kousen
 
The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84Mahmoud Samir Fayed
 
Collections in java
Collections in javaCollections in java
Collections in javakejpretkopet
 
Collections In Java
Collections In JavaCollections In Java
Collections In JavaBinoj T E
 
Python concurrency: libraries overview
Python concurrency: libraries overviewPython concurrency: libraries overview
Python concurrency: libraries overviewAndrii Mishkovskyi
 
More topics on Java
More topics on JavaMore topics on Java
More topics on JavaAhmed Misbah
 
A Scala tutorial
A Scala tutorialA Scala tutorial
A Scala tutorialDima Statz
 
Implementation of 'go-like' language constructions in scala [english version]
Implementation of 'go-like' language constructions in scala [english version] Implementation of 'go-like' language constructions in scala [english version]
Implementation of 'go-like' language constructions in scala [english version] Ruslan Shevchenko
 
Spock: A Highly Logical Way To Test
Spock: A Highly Logical Way To TestSpock: A Highly Logical Way To Test
Spock: A Highly Logical Way To TestHoward Lewis Ship
 
Object-Oriented Programming with C#
Object-Oriented Programming with C#Object-Oriented Programming with C#
Object-Oriented Programming with C#Svetlin Nakov
 
The Ring programming language version 1.3 book - Part 84 of 88
The Ring programming language version 1.3 book - Part 84 of 88The Ring programming language version 1.3 book - Part 84 of 88
The Ring programming language version 1.3 book - Part 84 of 88Mahmoud Samir Fayed
 

Similar to Classboxes: A Minimal Module Model Supporting Local Class Extension (20)

Feltman collections
Feltman collectionsFeltman collections
Feltman collections
 
Scala oo
Scala ooScala oo
Scala oo
 
Spock: Test Well and Prosper
Spock: Test Well and ProsperSpock: Test Well and Prosper
Spock: Test Well and Prosper
 
The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84
 
Inheritance
InheritanceInheritance
Inheritance
 
Collections
CollectionsCollections
Collections
 
Collections in java
Collections in javaCollections in java
Collections in java
 
Collections In Java
Collections In JavaCollections In Java
Collections In Java
 
Python concurrency: libraries overview
Python concurrency: libraries overviewPython concurrency: libraries overview
Python concurrency: libraries overview
 
More topics on Java
More topics on JavaMore topics on Java
More topics on Java
 
A Scala tutorial
A Scala tutorialA Scala tutorial
A Scala tutorial
 
Java Reflection Concept and Working
Java Reflection Concept and WorkingJava Reflection Concept and Working
Java Reflection Concept and Working
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 
Implementation of 'go-like' language constructions in scala [english version]
Implementation of 'go-like' language constructions in scala [english version] Implementation of 'go-like' language constructions in scala [english version]
Implementation of 'go-like' language constructions in scala [english version]
 
Spock: A Highly Logical Way To Test
Spock: A Highly Logical Way To TestSpock: A Highly Logical Way To Test
Spock: A Highly Logical Way To Test
 
Design patterns(red)
Design patterns(red)Design patterns(red)
Design patterns(red)
 
Object-Oriented Programming with C#
Object-Oriented Programming with C#Object-Oriented Programming with C#
Object-Oriented Programming with C#
 
The Ring programming language version 1.3 book - Part 84 of 88
The Ring programming language version 1.3 book - Part 84 of 88The Ring programming language version 1.3 book - Part 84 of 88
The Ring programming language version 1.3 book - Part 84 of 88
 
Design patterns
Design patternsDesign patterns
Design patterns
 
What's New In JDK 10
What's New In JDK 10What's New In JDK 10
What's New In JDK 10
 

More from 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
 

More from 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
 

Recently uploaded

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise 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
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
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
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
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
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
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
 
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
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
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
 
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
 
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
 
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
 

Recently uploaded (20)

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
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
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 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...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
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...
 
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
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 
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
 

Classboxes: A Minimal Module Model Supporting Local Class Extension

  • 1. Classboxes: A Minimal Module Model Supporting Local Class Extension Alexandre Bergel, Stéphane Ducasse, and Roel Wuyts Software Composition Group University of Bern (Switzerland) bergel@iam.unibe.ch
  • 2. Outline 1. Class extension and Package 2. Supporting Unanticipated Changes 3. The Classbox Model 4. Implementation 5. Conclusion 6. Future Work 1
  • 3. Class Extension • Languages such as CLOS or Smalltalk provide a mechanism of Class Extension • A Class Extension is the ability to add or redefine methods on a class after its creation 2
  • 4. Class Extension: A powerful Mechanism Visitor Example: BlackPackage Opr Add Mult 3
  • 5. Class Extension: A powerful Mechanism Visitor Example: BlackPackage BluePackage Opr acceptVisitor() Visitor doAdd() Add Mult doMult() acceptVisitor() acceptVisitor() 4
  • 6. Subclassing does not Solve it Opr Parser parse() Add Times … Add.new() Add’ Times’ … acceptVisitor() acceptVisitor() Subclasses are not referenced by the tree constructor 5
  • 7. In Smalltalk • Class extensions are global • Any application can modify any class in the system Consequences – Conflicts may arise (e.g., two applications may add the same method) – Robustness aspect (e.g., an application may redefine a critical method) 6
  • 8. Supporting Unanticipated Changes: Adaptation • Java, Modula-3,…have package/modules but no Class Extension • Smalltalk has Class Extension but no package/module fi Class Extension + Module ? • How to control class extensions? • How to apply a set of unanticipated changes without breaking existing clients? 7
  • 9. Classbox Model Definition • The Classbox Model is a minimal module model supporting local class extension • A Classbox – Is a unit of scoping (i.e., it acts as a namespace) – Can define classes – Can import class definitions from other classboxes – Can define methods on classes in the scope: class extensions • Classes and methods always belong to exactly one classbox • Visibility of each element in a classbox is bound to this classbox 8
  • 10. Classbox Model: Avoiding Conflict By having class TextClassbox import extensions local to a String classbox, conflicts are avoided URLClassbox URL WWWClassbox WWWURL String asUrl String WWWURL.new() asUrl … URL.new() … 9
  • 11. Classbox Model: Import and Visibility Extended classes can be TextClassbox import used by classboxes String through the import relationship URLClassbox URL RedClassbox String … asUrl url = “http://www.iam.unibe.ch/~scg”.asUrl() 10
  • 12. Classbox Model: Classbox as a Sandbox All the changes are local, so CollectionClassbox import redefinition of a critical method is limited to the Classbox OrderedCollection providing the extension do() GreenClassbox OrderedCollection do() aCollection.do(…) C C.new().foo() foo() 11
  • 13. Classbox Model: Flattening Property Any expression executed in a CollectionClassbox import classbox will be evaluated as if OrderedCollection the whole classbox graph were do() collapsed to a single classbox. copy() 2 GreenClassbox self.do(element.copy()) OrderedCollection do() 3 aCollection.copy(…) C C.new().bar() bar() 1 12
  • 14. From within the Green Classbox GreenClassbox self.do(element.copy()) OrderedCollection do() 3 copy() 2 aCollection.copy(…) C C.new().bar() bar() 1 13
  • 15. Implementation • Implemented in Squeak, an open-source Smalltalk • To avoid excessive memory costs: – modify the VM • New method lookup taking some extra parameters into account such as: – Original classbox (referring the classbox where the initial expression is executed) – Collection of all the traversed classboxes 14
  • 16. Lookup: Imports before Inheritance CollectionClassbox ImprovedClassbox PinkClassbox OrderedCollection OrderedCollection Pink do() do() foo() copy() aSortedCollection.copy() SortedCollection SortedCollection SortedCollection Pink.new().foo() Lookup of the copy() method 15
  • 17. Lookup: Imports before Inheritance CollectionClassbox ImprovedClassbox PinkClassbox OrderedCollection OrderedCollection Pink do() do() foo() copy() 6 5 4 aSortedCollection.copy() SortedCollection SortedCollection SortedCollection 3 2 1 Pink.new().foo() Lookup of the copy() method 16
  • 18. Lookup: Imports before Inheritance The copy() method invokes do() one CollectionClassbox ImprovedClassbox PinkClassbox OrderedCollection OrderedCollection PinkClass do() do() foo() copy() 5 4 aSortedCollection.copy() SortedCollection SortedCollection SortedCollection 3 2 1 Without any drastic optimization, a system is 60% slower 17
  • 19. Conclusion • Definition of a module system for controlling class extensions: – Method addition and replacement are only visible in the module that defines them – Control the visibility – Support for unanticipated evolution • New method lookup – This has a price: slow performance with the current implementation 18
  • 20. Future Work • Allow aliasing, when importing • Refined visibility control (allowing an extension to be global: evolution of a classbox) • Add multiple Classbox interfaces (clients may see a classbox under different views) • Formalization to specify the flattening property 19
  • 21. Contact Information • Alexandre Bergel (bergel@iam.unibe.ch) • Website: – http://www.iam.unibe.ch/~scg/Research/Classboxes/index.html 20