31 generic refactoring
play

31. Generic Refactoring International Symposium on Principles of - PowerPoint PPT Presentation

Obligatory Literature Technical University Dresden Department of Computer Science Chair for Software Technology Sander Tichelaar, Stphane Ducasse, Serge Demeyer, and Oscar Nierstrasz. A meta-model for language- independent refactoring. In


  1. Obligatory Literature Technical University Dresden Department of Computer Science Chair for Software Technology • Sander Tichelaar, Stéphane Ducasse, Serge Demeyer, and Oscar Nierstrasz. A meta-model for language- independent refactoring. In Proceedings of 31. Generic Refactoring International Symposium on Principles of Software Evolution (ISPSE '00), pages 157-167. IEEE for Programming and Computer Society Press, 2000. • doi:10.1109/ISPSE.2000.913233, Modeling Languages • MOOSE framework http://www.moosetechnology.org/ • Jan Reimann, Mirko Seifert, and Uwe Aßmann. Role- based generic model refactoring. In Dorina C. Petriu, Jan Reimann, Mirko Seifert, Prof. Uwe Aßmann Nicolas Rouquette, and Øystein Haugen, editors, MoDELS (2), volume 6395 of Lecture Notes in Computer Science, pages 78-92. Springer, 2010. 1. Fro 1. rom C Code to to Mo Models ls Best Paper Award. 2. 2. Rela lated Work rk Version 13-0.1, 17.1.11 3. 3. Role le-b -base sed Generic ric Mo Model l Refact ctorin ring 4. Eva 4. Evalu luatio ion 5. Contrib 5. ributio ions Prof. U. Aßmann, J. Reimann Role-based Generic Model Refactoring Folie 2 von XYZ From Code to Models An Example of Code Refactoring Why is Refactoring needed for Extract Method (Outlining) Models? • Model-Driven Software Development: • Models are partial code • Models are primary artefacts in MDSD • Good model design is essential for understandability • Some models are domain-specific, and belong to domain-specific languages (DSL) Why should it be generic? • Known code refactorings are transferable to many DSLs Core steps of refactorings are equal for different metamodels • A lot of additional effort to specify refactorings from scratch • Prof. U. Aßmann, J. Reimann Slide 3 Prof. U. Aßmann, J. Reimann Role-based Generic Model Refactoring Slide 4

  2. Related Work – Limitations Related Work – Limitations M3 layer specification M2 layer specification • Common meta-metamodel to static Lack of exact control of structures to be refactored • No genericity • Based ¡on No reuse • M3 Target ¡Metamodel Common ¡Object-­‑Oriented ¡ Meta-­‑Metamodel M2 Based ¡on Adaptation Target ¡Metamodel M2 [Taentzer, Gabriele, Dirk Müller and Tom Mens: Specifying Domain-Specific Refactorings for AndroMDA Based on [Moha, Naouel, Vincent Mahé, Olivier Barais und Jean-Marc Jézéquel: Generic Model Refactorings , MODELS 2009] Graph Transformation, AGTIVE 2007] Prof. U. Aßmann, J. Reimann Role-based Generic Model Refactoring Slide 5 Prof. U. Aßmann, J. Reimann Role-based Generic Model Refactoring Slide 6 Related Work – Limitations M1 layer specification No genericity • No reuse • 31.2 MOOSE M2 Target ¡Metamodel Propagation ¡into Example ¡Model M1 Recorded ¡in [Brosch, Petra, Philip Langer, Martina Seidl, Konrad Wieland, Manuel Wimmer, Gerti Kappel, Werner Retschitzegger and Wieland Schwinger: An Example is Worth a Thousand Words: Composite Operation Modeling By-Example , MODELS 2009] Prof. U. Aßmann, J. Reimann Role-based Generic Model Refactoring Slide 7 Prof. U. Aßmann, J. Reimann Role-based Generic Model Refactoring Folie 8 von XYZ

  3. FAMIX Upper Metamodel • The FAMIX upper metamodel • Enables generic refactoring for all entities above methods, not touching method bodies, such as class restructurings, class renamings, package refactorings, etc. • The MOOSE framework supplies basic graph algorithms for reengineering and refactoring: • Strongly connected components • Dominance • Kruskal spanning trees • Concept recognition in texts • Formal concept analysis http://www.mo http:// moose setech chnolo logy. y.org rg/?_s=5 s=5k2 k2-x-G -x-GDJjd Jjdd2YI YIX Prof. U. Aßmann, J. Reimann Role-based Generic Model Refactoring Folie 9 von XYZ Prof. U. Aßmann, J. Reimann Role-based Generic Model Refactoring Folie 10 von XYZ Role-based Generic Model Refactoring Role-based Design (Reenskaug, Riehle & Gross) • Definition of collaborations of objects in different contexts • Here: Context = model refactoring • Participants play role in concrete refactoring à Role Model 31.2 Refactory • Role-based transformation à Refactoring Specification • Application to desired parts of metamodel à Role Mapping DSL DSL ¡Meta ¡ Role ¡ Role ¡ Refactoring ¡ Refactoring ¡ Designer Model Mapping Model Specification Designer DSL Refactoring ¡ Refactored DSL ¡Model User Interpreter DSL ¡Model The generic refactorer of TU Dresden refers ¡to input ¡for instance ¡of returns Jan Reimann Prof. U. Aßmann, J. Reimann Design Patterns and Frameworks Folie 11 von XYZ Prof. U. Aßmann, J. Reimann Role-based Generic Model Refactoring Slide 12

  4. Role-based Generic Model Role-based Generic Model DSL Designer Ref. Designer DSL Designer Ref. Designer Refactoring Refactoring DSL User DSL User Role-based Metamodeling Refactoring Specification on Role Model • Refactory sees a role model (a view) of the • The roles of this role-metamodel can be used to write metamodel refactoring scripts and operators Prof. U. Aßmann, J. Reimann Role-based Generic Model Refactoring Slide 13 Prof. U. Aßmann, J. Reimann Role-based Generic Model Refactoring Slide 14 Role-based Generic Model DSL Designer Ref. Designer Evaluation of Refactory Refactoring DSL User Role Mapping to Specific DDL • A mapping maps roles to metaclasses in a concrete Starting point metamodel • 16 target metamodels of different complexity (Java, UML, Ecore…) • 53 concrete model refactorings Result • 9 generic model refactorings • 6 metamodel specific extensions were needed • 7 metamodels are multiple target of same model refactoring • 2 metamodels are at least target of every model refactoring Prof. U. Aßmann, J. Reimann Role-based Generic Model Refactoring Slide 15 Prof. U. Aßmann, J. Reimann Role-based Generic Model Refactoring Slide 16

  5. New: Multi-Quality Contracts in New: Multi-Quality Contracts in CPS (Multi-Technical Spaces) CPS (Multi-Technical Spaces) Refact ctore rer 1 1 Real- l- Real- l- time ime time ime Real-time contract checking Real-time contract checking (Technical Space 1) (Technical Space 1) Refact ctore rer 2 2 Sa Safety y Safety Sa y Safety contract checking Safety contract checking (Technical Space 2) (Technical Space 2) Comp mponent Comp mponent Comp mponent Comp mponent Refact ctore rer 3 3 B B B B A A A A Dyn yna Dyn yna Dynamics contract checking Dynamics contract checking mics mics mics mics (Technical Space 3) (Technical Space 3) Refact ctore rer 4 4 Energ En rgy y En Energ rgy y Energy contract checking Energy contract checking (Technical Space 4) (Technical Space 4) New: Multi-Quality Contracts in Lessons Learned CPS (Multi-Technical Spaces) Generic ric Refact ctore rer Refact ctore rer 1 1 • Refactorings generically specifiable if abstractable and Real- l- structurally transferable time ime Real-time contract checking (Technical Space 1) • Metamodel-specific refactorings possible • Design decisions Refact ctore rer 2 2 • ”Specific” generic refactoring Sa Safety y Safety contract checking • Metamodel-specific extension or (Technical Space 2) • Implementation of metamodel-specific refactoring (Java) • Reuse beneficial if model refactoring appliable to at Comp mponent Refact ctore rer 3 3 Comp mponent least two metamodels B B A A Dyn yna Dynamics contract checking mics mics (Technical Space 3) Refact ctore rer 4 4 Energ En rgy y Energy contract checking (Technical Space 4) Prof. U. Aßmann, J. Reimann Role-based Generic Model Refactoring Slide 20

  6. Contributions Contributions Outlook • Generic refactoring works!! • Pre- and postconditions with role-based OCL interpreter • Definition of generic model refactorings based on roles • Preservation of behavior with formalization of • Role models form a dedicated context for every model semantics refactoring • Approach allows both for genericity and control of the • Specification of model smells structures to be refactored • Co-Refactoring • Control is achieved by mapping of role models into • Automatic mapping to metamodels arbitrary sections of the target metamodel • Interpretation by resolving roles and collaborations into the target metamodel Prof. U. Aßmann, J. Reimann Role-based Generic Model Refactoring Slide 21 Prof. U. Aßmann, J. Reimann Role-based Generic Model Refactoring Slide 22 Students looked for in Resubic Lab Mapping to Paths Co-Refactoring of mulit-quality specificatios http://resubic.inf.tu-dresden.de SubElement SuperElement http://www.emftext.org/refactoring Classifier Generalization SuperElement 1 general 1 specific generalization 0..* SubElement jan.reimann@tu-dresden.de Role-based Generic Model Refactoring Role-based Generic Model Refactoring Prof. U. Aßmann, J. Reimann Slide 23 Prof. U. Aßmann, J. Reimann Slide 24

Recommend


More recommend