Presentation is loading. Please wait.

Presentation is loading. Please wait.

Modeling Change as a First-Class Entity Oscar Nierstrasz Software Composition Group, University of Bern

Similar presentations


Presentation on theme: "Modeling Change as a First-Class Entity Oscar Nierstrasz Software Composition Group, University of Bern"— Presentation transcript:

1 Modeling Change as a First-Class Entity Oscar Nierstrasz Software Composition Group, University of Bern

2 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Roadmap  Kinds of change  Piccola  Traits  Classboxes  Persephone & Geppetto  Object Flow Analysis & Unstuck  Moose  Changeboxes  Conclusions

3 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Roadmap  Kinds of change  Piccola  Traits  Classboxes  Persephone & Geppetto  Object Flow Analysis & Unstuck  Moose  Changeboxes  Conclusions

4 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Software inevitably changes …  … but programming languages and development environments go out of their way to inhibit change rather than to support it  Symptoms: —Assumption of global consistency —Static type systems —Design patterns —… Oscar Nierstrasz, Alexandre Bergel, Marcus Denker, Stéphane Ducasse, Markus Gaelli and Roel Wuyts, “On the Revival of Dynamic Languages,” Proceedings of Software Composition 2005

5 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Kinds of change  Configuration  Refactoring  New functionality  Run-time adaptation  Bug fixes  Versions and branches There is an urgent need for programming languages and environments to provide explicit support for encapsulating and manipulating change.

6 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Proposal: a mechanism to tame software change Changeboxes  Encapsulate change  Delimit the scope of change  Enable changes depending on context  Dispatch on dynamic context Oscar Nierstrasz, Marcus Denker, Tudor Gîrba and Adrian Lienhard, “Analyzing, Capturing and Taming Software Change,” In Proceedings of the ECOOP'06 Workshop on Revival of Dynamic Languages.

7 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Roadmap  Kinds of change  Piccola  Traits  Classboxes  Persephone & Geppetto  Object Flow Analysis & Unstuck  Moose  Changeboxes  Conclusions

8 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Problem: reconfigure applications (without changing everything) Solution: Applications = Components + Scripts  Separate stable components from flexible configurations  Components import and export services  Scripts plug together (not wire) components

9 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Piccola in a nutsehll  Composition style wraps components with plug and socket interfaces  Scripts plug together components using forms, agents and channels

10 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Franz Achermann and Oscar Nierstrasz, “Explicit Namespaces”, Proceedings of JMLC 2000 Piccola — lessons learned  First-class namespaces enable flexible composition —Conveniently express objects, components, modules, mixins layers, sandboxes, dynamic scoping …  Conceptual gap between core and target models —Components, plugs and styles vs. agents, forms and channels  Hard to express dynamically changing behaviour —Context is fixed

11 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Roadmap  Kinds of change  Piccola  Traits  Classboxes  Persephone & Geppetto  Object Flow Analysis & Unstuck  Moose  Changeboxes  Conclusions

12 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Problem: refactoring commonality (without introducing fragility) Solution  Factor commonalities into “traits”  Resolve conflicts locally

13 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Traits in a nutshell Traits are parameterized behaviors —Traits provide a set of methods ( ) —Traits require a set of methods ( ) —Traits do not specify any state TCircle area bounds diameter hash... radius radius: center center: Object ColoredCircle TColor TCircle Class = Superclass + State + Traits + Glue Stéphane Ducasse, Oscar Nierstrasz, Nathanael Schärli, Roel Wuyts and Andrew Black, “Traits: A Mechanism for fine-grained Reuse,” ACM TOPLAS, March 2006

14 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Alexandre Bergel, Stéphane Ducasse, Oscar Nierstrasz and Roel Wuyts, “Stateful Traits,” Proceedings of the International Smalltalk Conference, 2006, LNCS, to appear. Traits — lessons learned  Flattening property —No special semantics — traits can be “compiled away”  Composing class retains control —Key to overcoming fragility  Can be extended to include state —State is private, unless explicitly exposed  Missing means to package collaborating traits —Purely fine-grained components  Missing means to dynamically activate traits —Traits are purely static (due to flattening)

15 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Roadmap  Kinds of change  Piccola  Traits  Classboxes  Persephone & Geppetto  Object Flow Analysis & Unstuck  Moose  Changeboxes  Conclusions

16 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Problem: extending functionality (without breaking anything) Solution  A class extension adds or refines features of existing classes  Restrict visibility of class extensions to well-defined scope

17 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Classboxes MorphCB Morph repaint paint Button new repaint Button... self paint... NewMorphCB paint import Button new repaint Button class extension Morph “new implementation” Extensions in classboxes are locally rebound Alexandre Bergel, Stéphane Ducasse, Oscar Nierstrasz and Roel Wuyts, “Classboxes: Controlling Visibility of Class Extensions,” Computer Languages, Systems and Structures, December 2005

18 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Alexandre Bergel and Stéphane Ducasse, “Scoped and Dynamic Aspects with Classboxes,” L'Objet, November 2005 Alexandre Bergel and Stéphane Ducasse, “Supporting Unanticipated Changes with Traits and Classboxes,” Proceedings NODE'05 Classboxes — lessons learned  Dynamic classboxes —Run-time enabling of aspects with dynamic classboxes  Traits + classboxes —Packaging collaborations as classboxes  Missing semantics of extension —Additions, modifications or refactorings?

19 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Roadmap  Kinds of change  Piccola  Traits  Classboxes  Persephone & Geppetto  Object Flow Analysis & Unstuck  Moose  Changeboxes  Conclusions

20 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Problem: changing a running system (without anticipated hooks) Solution  Reflection on-demand —Runtime structural reflection —Unanticipated, partial behavioural reflection

21 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, First Idea: ByteSurgeon But …  Bytecode is too low level (Example>>#example) instrumentSend: [:send | send insertBefore: ‘Transcript show: ‘’sending #test’’ ‘. ] (Example>>#example) instrumentSend: [:send | send insertBefore: ‘Transcript show: ‘’sending #test’’ ‘. ] Marcus Denker, Stéphane Ducasse and Éric Tanter, “Runtime Bytecode Transformation for Smalltalk,” Journal of Computer Languages, Systems and Structures, July 2006  Structural reflection on-demand —Transform bytecode at runtime – Inline Smalltalk code before / after a bytecode

22 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Persephone: Reflective Methods  High level model of sub-method structure —Abstract Syntax Tree (AST) —Bytecode generation on demand  Annotations for AST nodes —Meta data for any node —CompilerPlugin provides optionally semantics Philippe Marschall, “Persephone: Taking Smalltalk Reflection to the sub-method Level”, Masters thesis, University of Bern, December 2006.

23 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Geppetto  Behavioural reflection on-demand —Uses annotations to link code to metaobjects —Reify language constructs – Message-sending – Variable access David Röthlisberger, Marcus Denker and Éric Tanter, “Unanticipated Partial Behavioral Reflection,” 14th International Smalltalk Conference, 2006

24 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Oscar Nierstrasz, Alexandre Bergel, Marcus Denker, Stéphane Ducasse, Markus Gaelli and Roel Wuyts, “On the Revival of Dynamic Languages,” Proceedings of Software Composition 2005 Reflection on-demand — lessons learned  High-level reflection enables analysis —Applications to fast method wrappers, run-time tracing, test coverage analysis …  Reflection need not be expensive —On-demand = partial and unanticipated  Reflection should be scoped to relevant contexts —Need mechanisms to specify and trigger scoping

25 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Roadmap  Kinds of change  Piccola  Traits  Classboxes  Persephone & Geppetto  Object Flow Analysis & Unstuck  Moose  Changeboxes  Conclusions

26 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Problem: tracking down defects (when the offending context is already gone) Solution  Keep track of object flow  Maintain history of running application

27 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Object Flow Analysis  Track flow of object references by means of first-class aliases —Trace back flow from errors to code that produced the objects Adrian Lienhard, Stéphane Ducasse and Tudor Gîrba, “Object-Centric View on Dynamic Analysis”, submitted

28 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Unstuck — a back-in-time debugger Christoph Hofer, Marcus Denker and Stéphane Ducasse, “Design and Implementation of a Backward-In-Time Debugger,” NODE'06, 2006

29 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Object flow / Unstuck — lessons learned  Scoped reflection helps to control instrumentation —Don’t instrument the instrumentation infrastructure! —Instrument code only while running in relevant context  High cost of instrumentation and data analysis —Can significantly lower cost of development —Can scoped reflection help to further reduce cost?

30 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Roadmap  Kinds of change  Piccola  Traits  Classboxes  Persephone & Geppetto  Object Flow Analysis & Unstuck  Moose  Changeboxes  Conclusions

31 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Problem: understanding change (without reading all the code) Solution  Represent history as a first-class entity  Use simple visualizations to expose patterns

32 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, The Evolution Matrix Michele Lanza, “The Evolution Matrix: Recovering Software Evolution using Software Visualization Techniques,” IWPSE 2001

33 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Hierarchy evolution view Tudor Gîrba, Michele Lanza and Stéphane Ducasse, “Characterizing the Evolution of Class Hierarchies,” CSMR'05

34 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Ownership maps  Colour lines to show who “owns” an artifact —I.e., who wrote most lines of code DialogueMonologueFamiliarization EditTakeover Tudor Gîrba, Adrian Kuhn, Mauricio Seeberger and Stéphane Ducasse, “How Developers Drive Software Evolution,” IWPSE 2005

35 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Moose Smalltalk (VW) Browsing Metrics Querying Grouping Extensible meta model Model repository Smalltalk Java C++ … CVS SVN MSE External Parser Mondrian DynaVan...Hapax CodeCrawler

36 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Oscar Nierstrasz, Stéphane Ducasse and Tudor Gîrba, “The Story of Moose: an Agile Reengineering Environment,” ESEC/FSE 2005 Moose — lessons learned  Make your meta-model explicit —Helps to develop and integrate tools  Use a dynamic programming environment —Speeds development of new ideas —No artificial compile-time/run-time dichotomy!  Need change as a first-class entity —Capture semantics of change —Manipulate change —Reason about the impact of change

37 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Roadmap  Kinds of change  Piccola  Traits  Classboxes  Persephone & Geppetto  Object Flow Analysis & Unstuck  Moose  Changeboxes  Conclusions

38 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Problem: changing a running system (without impacting clients) Solution  Treat change as a first-class entity

39 © Oscar Nierstrasz, 2007 EOS DUE — Cesena,

40 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Changeboxes  Encapsulate change —Capture changes to methods, state, class hierarchy – Express semantics of refactoring and other changes  Delimit the scope of change —Restrict scope of changes to specific clients – Delay global impact  Enable changes depending on context —Dynamically extend the scope of changes – Manage system evolution  Dispatch on dynamic context —Dynamically apply or disable changes – Temporally or contextually scope changes

41 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Pascal Zumkehr, “Changeboxes — Modeling Change as a First Class Entity,” Masters thesis, University of Bern, January Changeboxes — lessons learned  The world is inconsistent — deal with it! —Changeboxes enable inconsistent views  Need to capture higher-level semantics of change —Tools must be aware of meaning of change to record it  Need new metaphors for managing change —Missing tools to manipulate N-dimensional change

42 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Roadmap  Kinds of change  Piccola  Traits  Classboxes  Persephone & Geppetto  Object Flow Analysis & Unstuck  Moose  Changeboxes  Conclusions

43 © Oscar Nierstrasz, 2007 EOS DUE — Cesena, Conclusions — Taming change with changeboxes  Directions —Capturing high-level semantics of changes – Refactoring transformations —Dynamic propagation of changes – Forking and merging of concurrent versions —Context-oriented programming – Multi-dimensional dispatch  Challenges —Suitable core language? —Reasoning about change? —More flexible forms of static typing? Questions? Comments? Questions? Comments?

44


Download ppt "Modeling Change as a First-Class Entity Oscar Nierstrasz Software Composition Group, University of Bern"

Similar presentations


Ads by Google