Maintainability of Transformations in Evolving MDE Ecosystems Jokin García Pérez Supervisor: Prof. Oscar Díaz [email protected] Index 1. Background 2. Problem statement 3. Model transformation co-evolution 4. Adapter-based approach to co-evolve generated SQL in M2T transformations 5. Testing MOFScript transformations with HandyMOF 6. Conclusions 7. Future work Index 1. Background 2. Problem statement 3. Model transformation co-evolution 4. Adapter-based approach to co-evolve generated SQL in M2T transformations 5. Testing MOFScript transformations with HandyMOF 6. Conclusions 7. Future work What is MDE? What is MDE? It’s all about models 1 Models are the primary artifact 1 Models are the primary artifact 2 Models are abstractions of reality abstractedIn REALITY 1 Models are the primary artifact 2 Models are abstractions of reality abstractedIn REALITY 3 Models conform to metamodels Metamodel 1 Models are the 2 primary artifact Models are abstractions of reality abstractedIn REALITY 3 Models conform to metamodels 4 Models are transformed Metamodel transformation Ecosystem Balance Human eats Mussel Phitoplankton Zooplankton Fish MDE Ecosystem Holistic maintenance Metamodel Conforms To M2M Transf. M2M Transf. M2T Transf. Maintainability 50-90% of the total sw cost MDE Maintainability - Increase of the number of artifacts - Increase in the complexity of artifacts - Larger upfront investment Evolution Multidimensional Co-Evolution Adaptation Index 1. Background 2. Problem statement 3. Model transformation co-evolution 4. Adapter-based approach to co-evolve generated SQL in M2T transformations 5. Testing MOFScript transformations with HandyMOF 6. Conclusions 7. Future work Problem statement Change detection Change impact analysis Change propagation Verify and validate Problem statement Change detection Problem statement MMa MMt MMb Ma Tab Mb Δ? MMb’ M2T Δ? Platform Platform’ Problem statement Change detection Change impact analysis Problem statement MMa Ma MMt Tab MMb ? M2T MMb’ Mb ? Platform Platform’ Problem statement Change detection Change impact analysis Change propagation Problem statement MMa MMt MMb Ma Tab Mb Δ MMb’ M2T Platform Δ Platform’ Problem statement Change detection Change impact analysis Change propagation Verify and validate Problem statement MMa MMt MMb Ma Tab Mb MMb’ M2T Platform Platform’ Index 1. Background 2. Problem statement 3. Model transformation co-evolution 4. Adapter-based approach to co-evolve generated SQL in M2T transformations 5. Testing MOFScript transformations with HandyMOF 6. Conclusions 7. Future work Index 3. Model transformation co-evolution 1. Problem statement 2. Solution 3. Case study 4. Proof-of-concept Context 1 2 Metamodel evolution Alternative versions, adapt to formalism, correct errors, refactor, … Model co-evolution to metamodel changes Bibliography Problem statement Problem Metamodel evolution 1 2 Problem statement Impacts on transformations MMa MMt Ma Tab Manual migration of these transformations Cumbersome and error-prone MMb Mb Problem 1 Semi-automatic migration process Impacts on transformations Problem statement Index 3. Model transformation co-evolution 1. Problem statement 2. Solution 3. Case study 4. Proof-of-concept Process 1 MM and evolved MM Detection: simple changes 2 Detection: complex changes 3 Solution Simple changes Changes Co-evolution Similarity analysis Similarity model Co-evolved transf. Transf. 4 CNF conversion Normalized transf. Detection stage 1 Retrieve simple changes 2 Convert simple changes to complex Solution Using a comparison tool If they are semantically related AddModelElement UpdateAttribute RemoveModelElement SplitClass Co-evolution stage Solution Define correspondences that map the original transformation into an evolved transformation Taxonomy of changes based on the impact Non Breaking Changes (NBC) Breaking and Resolvable Changes (BRC) Breaking and Unresolvable Changes (BUC) “Everything is a model” philosophy: implemented as HOTs Co-evolution stage Auxiliary steps Conjunctive Normal Form conversion not ((A and B) or C) -> (not A or not B) and not C Similarity analysis Similarity = 1 Target 1 Source 1 Similarity = 0 Target 2 Solution Minimum deletion Solution Delete only the strictly necessary rule fragments String concatenation s3 <- s1 + s2. If s1 is removed: s3 <- s2 Collections Set{A, B, C}. If A is removed: Set{B, C} Boolean expressions not ErasmusGrant or (speakEnglish and enrolledLastYear). If speakEnglish is removed: not ErasmusGrant or enrolledLastYear Index 3. Model transformation co-evolution 1. Problem statement 2. Solution 3. Case study 4. Proof-of-concept Metamodels Case study 1 Extract superclass Case study The AssistantMVC's Multiple class is introduced in the target metamodel Extract superclass is a NBC case. No action is needed 2 Delete metaproperty The metaproperty optional is deleted from ExamElement minimum deletion is applied Case study 2 Delete metaproperty Opposite filters in two rules Rule 1 (value>5 and optional) or long (value > 5 or long) Rule 2 not ((value>5 and optional) or long) (not value>5 or not optional) and not long (not value>5 and not long) Case study 3 Type change Case study The AssistantMVC's fontName metaproperty is changed from string to integer BUC in most of the cases. Only few cases are NBC 4 Split class Case study The AssistantMVC's OpenElement class is splitted into OpenElement_1 and OpenElement_2 4 Split class One rule will become two, and bindings will be moved to the corresponding rule depending on the used metaproperty Case study 5 Add class and property New subclass ExerciseElement and metaproperty style Case study Index 3. Model transformation co-evolution 1. Problem statement 2. Solution 3. Case study 4. Proof-of-concept Proof of concept Prototype for Ecore-based MMs and ATL Simple changes -> Complex changes HOT to adapt transformation to changes Index 1. Background 2. Problem statement 3. Model transformation co-evolution 4. Adapter-based approach to co-evolve generated SQL in M2T transformations 5. Testing MOFScript transformations with HandyMOF 6. Conclusions 7. Future work Index 4. Adapter-based approach to co-evolve generated SQL in M2T transformations 1. Problem statement 2. Case study 3. Solution 4. Evaluation 5. Proof-of-concept Context Problem statement 1 Software componets on top of platforms 2 Platform evolution is a common situation Dependencies DB, API, … Blog CMS Wiki Application API Context 3 Perpetual beta state of platforms 4 External dependency Increase frequency of releases Out of our control Problem statement Context Domain model M2T Transf. Model refs. Transformation code Embedded platform code Problem statement Code Problem Problem statement Different versions of the platform leave the code and M2T transformation outdated M2T ? Code DB Δ DB’ Solution Problem statement Adapter to adapt generated code to new platform M2T Adapter Code DB Code Δ DB’ Index 4. Adapter-based approach to co-evolve generated SQL in M2T transformations 1. Problem statement 2. Case study 3. Solution 4. Evaluation 5. Proof-of-concept MediaWiki DB in Wikiwhirl Case study MediaWiki + 40.000 + 200 Used by Wikipedia and more than 40.000 wikis Schema upgrades Case study MediaWiki DB in Wikiwhirl Case study Platform-dependent concepts Refs. to domain model Index 4. Adapter-based approach to co-evolve generated SQL in M2T transformations 1. Problem statement 2. Case study 3. Solution 4. Evaluation 5. Proof-of-concept Solution overview Solution Synchronize the generated code with platform Using adapters at runtime M2T print("INSERT into categorylinks (cl_from, cl_to, cl_sortkey, cl_timestamp) VALUES (@pageId, '" + categoryTitle + "','" + pageTitle) Adapter New columns “cl_type”, “cl_sortkey_prefix” and “cl_collation” Code DB’ INSERT INTO categorylinks (cl_from, cl_to, cl_sortkey, cl_timestamp, cl_type, cl_sortkey_prefix, cl_collation) VALUES (@pageId, ‘Softwareproject’, ‘House_Testing’, (DATE_FORMAT(CURRENT_TIMESTAMP(), ‘%Y%m%d%k%i%s’), ‘page’, ‘’, ‘0’); Process outline Solution Comparison (EMFCompare) Domain model Difference model Transformation (M2T + adapter) New schema model Old schema model Injection (Schemol) Injection (Schemol) 3 Code (MediaWiki DB) 2 1 New MediaWiki schema Old MediaWiki schema Process outline Comparison (EMFCompare) All in one click Domain model Difference model Transformation (M2T + adapter) 2 New schema model Old schema model Injection (Schemol) Injection (Schemol) 3 Code (MediaWiki DB) Solution 1 New MediaWiki schema Old MediaWiki schema Differences between platforms: DB schema Injection (Schemol) Solution Comparison (EMFCompare) Process: Schema Modification Operators (SMO) SMO % of usage Change type Solution Adaptation Create table 8.9 NBC New comment in the transformation on the existence of this table in the new version Drop table 3.3 BRC Delete statement associated to the table Rename table 1.1 BRC Update name Copy table 2.2 NBC (None) Add column 38.7 NBC/ BRC For insert statements: if the attribute is Not Null, add the new column in the statement with a default value (from the DB if there is available or according to the type if there is not) Drop column 26.4 BRC Delete the column and the value in the statement Rename column 16 BRC Update name Copy column 0.4 BRC Like add column case Move column 1.5 BRC Like drop column + add column cases Adaptation Plaform-specific, schema-independent 1 “println” instructions are replaced with “printSQL” 2 Import “printSQL” library 3 ZQL extension 4 For each printSQL invocation Iterate over the changes reported in the Difference model Checks if any of the changes impacts the current statement Needed information to adapt the statement is retrieved and added to a list of parameters: the statement, affected table, column, … A function that adapts the statement is called and new statement is printed Solution Adaptation output Solution Added columns Delete tables Delete columns Dump changes from code to transformation Solution Assist manual propagation Record generation with change to be done and where (line and column in the transformation) M2T transformation print(“select * from …”) HOT M2T transformation’ printSQL(“select * from …”, line, column) RECORD: #Added columns cl_type, cl_sortkey_prefix and cl_collation #transformation line: 12, column: 11 INSERT INTO categorylinks (cl_from, cl_to, cl_sortkey, cl_timestamp, cl_type, cl_sortkey_prefix, cl_collation) VALUES (@pageId, ‘Softwareproject’, ‘House_Testing’, (DATE_FORMAT(CURRENT_TIMESTAMP(), ‘%Y%m%d%k%i%s’), ‘page’, ‘’, ‘0’); Roles Producer Injector for target platform Implement adapter as a library for transformation Consumer Import adapter library in the transformation Execute the batch Solution Index 4. Adapter-based approach to co-evolve generated SQL in M2T transformations 1. Problem statement 2. Case study 3. Solution 4. Evaluation 5. Proof-of-concept Cost equations Manual Cost = D + P * #Impacts D: Detection time P: Propagation time Assisted Cost = C + V * #Impacts C: Configuration time V: Verification time Evaluation Manual vs Assisted Evaluation Index 4. Adapter-based approach to co-evolve generated SQL in M2T transformations 1. Problem statement 2. Case study 3. Solution 4. Evaluation 5. Proof-of-concept Proof of concept Library for MOFScript transformation Batch that automatized the whole process: injection, comparison, execution Empirical evaluation Index 1. Background 2. Problem statement 3. Model transformation co-evolution 4. Adapter-based approach to co-evolve generated SQL in M2T transformations 5. Testing MOFScript transformations with HandyMOF 6. Conclusions 7. Future work Index 5. Testing MOFScript transformations with HandyMOF 1. Motivating scenario 2. Problem 3. Solution 4. Proof-of-concept 5. Demo Motivating scenario M2T Case study Motivating scenario Case study Java Model MofScript Transformation Index 5. Testing MOFScript transformations with HandyMOF 1. Motivating scenario 2. Problem 3. Solution 4. Proof-of-concept 5. Demo 1 line line 2 line line Problem Traceability ? M2T Index 5. Testing MOFScript transformations with HandyMOF 1. Motivating scenario 2. Problem 3. Solution 4. Proof-of-concept 5. Demo Traceability in HandyMOF 1 HOT transformation M2T M2T 2 Solution Execution M2T Traces Calculates physical positions 3 executed ? Solution White-box testing Highly coupled to the language M2T: no winner language Hybrid approach 1 Generate test suite with black-box testing 2 Check lines covered by this suite ? Solution Testing in HandyMOF 1 Test model generation Pramana 2 Trace generation Solution Testing in HandyMOF 3 Solution Finding minimal model suite Model suite Minimal model suite Architecture metamodels models transformations Solution Pramana HandyMOF TraceGenerator MinimalModelSuiteFinder traces generated code Index 5. Testing MOFScript transformations with HandyMOF 1. Motivating scenario 2. Problem 3. Solution 4. Proof-of-concept 5. Demo Proof of concept HandyMOF tool Visualizes graphically traceability between transformation and code Coverage analysis of test suite in transformation Index 5. Testing MOFScript transformations with HandyMOF 1. Motivating scenario 2. Problem 3. Solution 4. Proof-of-concept 5. Demo http://onekin.org/downloads/public/screencasts/handyMOF.htm Index 1. Background 2. Problem statement 3. Model transformation co-evolution 4. Adapter-based approach to co-evolve generated SQL in M2T transformations 5. Testing MOFScript transformations with HandyMOF 6. Conclusions 7. Future work Model transformation co-evolution Conclusions Semi-automatic process to adapt transformations to metamodel evolution Derive complex changes from simple changes Minimum deletion Map the original transformation into an evolved transformation that tackles MM changes Ecore-based MMs ATL transformations Co-evolve generated code Premises: platform instability and transformation coupling Mechanism to adapt code generated by M2T transformations to platform evolution Apply in a specific case study MediaWiki DB Assist dumping changes to the transformation Conclusions Testing M2T transformations 1 line 2 line 3 executed line line ? Conclusions General contributions Conclusions Point out and study the coupling between artifacts in MDE ecosystem and its implication MM – M2M transf., Platform – M2T transf. Improve traceability mechanisms M2T transf. - code Synchronization techniques for co-evolution MM – M2M transf. (HOT), Platform – M2T transf. (Adapter) Index 1. Background 2. Problem statement 3. Model transformation co-evolution 4. Adapter-based approach to co-evolve generated SQL in M2T transformations 5. Testing MOFScript transformations with HandyMOF 6. Conclusions 7. Future work Model transformation co-evolution Empirical assessment Real scenario Future work Co-evolve generated code Generalization: other platforms Methodology for adapter development Future work Testing M2T transformations Assist in creating missing models Improve minimal model suite algorithm Add other M2t transformation languages Evaluation Future work Future research Good practices in transformations M2T transf.: model world – text world Future work Dissemination & contrast Model Transformation Co-evolution: A Semi-automatic Approach Software Language Engineering (SLE) 2012, Dresden (Germany) An Adapter-Based Approach to Co-evolve Generated SQL in M2T Transformations Advanced Information Systems Engineering (CAiSE) 2014, Thessaloniki (Greece) Testing MOFScript Transformations with HandyMOF International Conference on Model Transformations (ICMT) 2014, York (UK) Comments Questions Prototypes: www.onekin.org/content/jokin-garcia-0 [email protected]
© Copyright 2025 Paperzz