370 likes | 382 Views
Learn how to automate the lift of transformations for product lines, optimizing software development processes and ensuring correctness.
E N D
Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro, Marsha Chechik University of Toronto Department of Computer Science
Product lines • Manage a large number of similar but different artifact variants (products) • Washing Machine Co. +Dry/Delay +Delay +Heat +Dry … Lifting Transformations to Product Lines
Feature Model Product line structure Heat • Product line (annotative) represented by • Domain Model – combined parts from all products • Feature Model – shows possible features and restrictions for products • Washing Machine Co. excludes Delay Wash Dry Domain Model +Dry/Delay +Delay +Heat +Dry … Lifting Transformations to Product Lines
Feature Model Product line configuration – example 1 Heat • +Heat product • Feature configuration: {Wash, Heat} • Washing Machine Co. excludes Delay Wash Dry +Dry/Delay +Delay +Heat +Heat +Dry … Lifting Transformations to Product Lines
Feature Model Product line configuration – example 2 Heat • +Dry/Delay product • Feature configuration: {Wash, Dry, Delay} • Washing Machine Co. excludes Delay Wash Dry +Dry/Delay +Delay +Heat +Dry +Dry/Delay … Lifting Transformations to Product Lines
Model product line:washing machine state machine Feature Model Heat Presence Conditions excludes Delay Wash Domain Model Heat Delay [heatEnabled;delayEnabled]/ HeaterOn() Dry Heat Locking Waiting Heat Delay / HeaterOff(); wash.Start(); [not heatEnabled;not delayEnabled]/ wash.Start(); Heat Washing entry/TempCheck() Heat / QuickCool() Unlocking Heat Dry / QuickCool() Dry Dry Dry Drying Lifting Transformations to Product Lines
Configuring a model (product) Feature Model Heat excludes Delay Wash Domain Model Heat Delay [heatEnabled;delayEnabled]/ HeaterOn() Dry Heat Locking Waiting Heat Delay / HeaterOff(); wash.Start(); [not heatEnabled;not delayEnabled]/ wash.Start(); Heat Washing entry/TempCheck() Heat / QuickCool() Unlocking Heat Dry / QuickCool() Dry Dry Dry Drying Lifting Transformations to Product Lines
+Dry/Delay state machine +Dry/Delay Variant [ delayEnabled] Locking Waiting / wash.Start(); [ not delayEnabled]/ wash.Start(); Washing Unlocking / QuickCool() Drying Lifting Transformations to Product Lines
+Dry/Delay state machine +Dry/Delay Variant [delayEnabled] Locking Waiting /wash.Start(); [not delayEnabled]/ wash.Start(); Washing Unlocking / QuickCool() Drying Lifting Transformations to Product Lines
Outline • Product lines • Transformations • Why lift transformations to product lines? • Sketch of lifting algorithm • Evaluation • Summary and next steps Lifting Transformations to Product Lines
Transformations in Model Driven Engineering (MDE) • Use to convert one artifact into another • For refinement, generating implementations, refactoring, optimization, translation, etc. • Automates mundane tasks and ensures quality • Enables raising level of abstraction in software development WideYellow Lifting Transformations to Product Lines
Our goal • Key problem: Transformations written for models cannot be used directly with product lines of models • Ideally we should lift them to product lines - but how? configure configure ? Model Model Product Line Model Model Model Model Lifting Transformations to Product Lines
Idea 1 – Avoid lifting transformation Heat • Problems: • Must keep track of transformations to apply • Can’t do analysis of transformation’s effect on product line excludes Delay Wash Dry configure WideYellow +Dry +Dry Lifting Transformations to Product Lines
Idea 2: Configure all products and merge Heat Heat • Problems: • Expensive: may be many products! • Merge is non-trivial excludes excludes Delay Delay Wash Wash Dry Dry configure merge WideYellow WideYellow +Dry +Dry WideYellow +Delay +Delay Lifting Transformations to Product Lines
Idea 3: Manually lift by re-developing transformation Heat Heat • Problems: • Requires extensive effort • Error-prone excludes excludes Delay Delay Wash Wash Dry Dry Manual Lift WideYellow Lifting Transformations to Product Lines
Our contribution: Automate the lift Heat Heat • Benefits • Low cost • Eliminates manual effort • Guarantees correctness excludes excludes Delay Delay Wash Wash Dry Dry Automated Lift WideYellow Lifting Transformations to Product Lines
Outline • Product lines • Transformations • Why lift transformations to product lines? • Sketch of lifting algorithm • Evaluation • Summary and next steps Lifting Transformations to Product Lines
Example: State machine refactoring transformation Negative Application Condition NAC Applicability Condition: Apply the rule if the LHS matches and no NAC matches Lifting Transformations to Product Lines
Applying FoldEntry – example 1 [delayEnabled] NAC Matching Site FoldEntry +Dry/Delay Variant Unlocking Locking Waiting / QuickCool() /wash.Start(); [not delayEnabled] / wash.Start(); Drying Washing No NAC matches – applicability condition passes Apply rule Lifting Transformations to Product Lines
Applying FoldEntry – example 1 +Dry/Delay Variant [delayEnabled] NAC Locking Waiting FoldEntry Washing entry/ wash.Start(); Unlocking / QuickCool() [not delayEnabled] Drying Lifting Transformations to Product Lines
Applying FoldEntry – example 2 NAC FoldEntry [heatEnabled]/ HeaterOn() Locking Waiting +Heat Variant Matching Site / HeaterOff(); wash.Start(); NAC Matches – applicability condition fails Do not apply rule [not heatEnabled] / wash.Start(); Washing entry/TempCheck() / QuickCool() Unlocking Lifting Transformations to Product Lines
How to apply FoldEntry to a Product Line? Feature Model Heat excludes Delay Wash Domain Model Heat Delay [heatEnabled;delayEnabled]/ HeaterOn() Dry Heat Locking Waiting Heat Delay / HeaterOff(); wash.Start(); [not heatEnabled;not delayEnabled]/ wash.Start(); Heat Washing entry/TempCheck() Heat / QuickCool() Unlocking Heat Dry / QuickCool() Dry Dry Dry Drying Lifting Transformations to Product Lines
Lifting algorithm sketch • Find matching sites in the domain model • Reinterpret rule applicability condition • Rule must be applicable in at least one product • requires SAT check • Reinterpret how to apply the rule • Modify domain model and presence conditions so rule effect only occurs in applicable products Lifting Transformations to Product Lines
Feature Model Heat Domain Model excludes [delayEnabled] [heatEnabled;delayEnabled]/ HeaterOn() Delay Wash Locking Waiting Delay Heat / HeaterOff(); wash.Start(); [not heatEnabled;not delayEnabled] /wash.Start(); Dry [heatEnabled]/ HeaterOn() Locking Waiting Washing entry/TempCheck() +Dry/Delay Variant / QuickCool() Heat Delay Unlocking +Heat Variant 1) Matching Site Unlocking / wash.Start(); / HeaterOff(); wash.Start(); 2) Lifted rule applicability condition passes Apply rule 2) Rule applicable in at least one product? Locking Waiting Heat / QuickCool() Drying / QuickCool() / wash.Start(); /wash.Start(); Washing entry/TempCheck() +Dry/Delay Variant Drying +Heat Variant Heat / QuickCool() Unlocking Washing Heat Heat Dry Dry Dry Dry Lifting Transformations to Product Lines
Feature Model Heat excludes [delayEnabled] Delay Wash [not heatEnabled;not delayEnabled] /wash.Start(); Dry [heatEnabled]/ HeaterOn() Locking Waiting Domain Model +Dry/Delay Variant +Heat Variant [heatEnabled;delayEnabled]/ HeaterOn() Unlocking / wash.Start(); / HeaterOff(); wash.Start(); Locking Waiting Locking Waiting / QuickCool() / wash.Start(); /wash.Start(); Washing entry/TempCheck() +Dry/Delay Variant / HeaterOff(); wash.Start(); Drying +Heat Variant / QuickCool() Unlocking Washing Washing entry/TempCheck(); wash.Start(); / QuickCool() Unlocking 3) Apply rule domain model and update presence conditions Heat / QuickCool() Delay Drying Lifting Transformations to Product Lines
Properties of lifting algorithm • Correct • Lifting satisfies the correctness condition • Termination • Lifting preserves rule set termination • Confluence • Lifting preserves rule set confluence • up to product line equivalence Lifting Transformations to Product Lines
Outline • Product lines • Transformations • Why lift transformations to product lines? • Sketch of lifting algorithm • Evaluation • Summary and next steps Lifting Transformations to Product Lines
Prototype Implementation • Modified the Henshin [Arendt et al.] graph transformation engine to • Use the lifting semantics for rule execution • Use Z3 [Microsoft] for SAT checks via MMTF [U of T] Henshin Graph Transformation Engine (modified) Model Management Tool Framework(MMTF) Eclipse Workbench Z3 SMT Solver Lifting Transformations to Product Lines
Application: Car Crash Management Product Line Objective: Illustrate lifting on a more realistic scenario • Benchmark used in modeling studies • 15,360 products (class diagram variants) • 444 elements, 118 presence conditions • Applied to two transformations • (AddGet) Class Diagram to Class Diagram • adds getters to public data members (1 rule) • (C2R) Class Diagram to Relational Database schema • Translates a class diagram to equivalent schema (9 rules) Lifting Transformations to Product Lines
Application: Car Crash Management Product Line • Objective: Illustrate lifting on a more realistic scenario • Benchmark used in modeling studies • 15,360 class diagram variants • Applied to two transformations • (C2R) Class Diagram to Relational Database schema • Translates a class diagram to equivalent schema (9 rules) • (AddGet) Class Diagram to Class Diagram • Refactoring that adds getters to public data members (1 rule) Results Some slowdown but much better than applying to all 15,360 products! Lifting Transformations to Product Lines
Scalability Study • (RQ) How does lifted rule execution time scale with: • Size of product line (# of features) • Size of transformation rule (# of elements) • Method • Varying product lines: use the S.P.L.O.T. feature model repository • 359 real feature models from 9 to 290 features • Varying rules: use 7 rules of varying sizes from the literature • Problem: domain models/presence conditions hard to find! • Solution: simulate using random rule matching • Tuned various parameters using the Car Crash Product Line example • Details available online Lifting Transformations to Product Lines
Results – time vs. features 12 Time seems to increase with rule size and then suddenly drops! 39 13 # of match elements 4 37 20 25 Time increase close to linear with # of features Lifting Transformations to Product Lines
Results - # UNSAT vs. features 25 20 37 # of match elements 4 13 39 12 Reason: larger rules have more fast UNSAT results Lifting Transformations to Product Lines
Summary • Product lines and transformations help manage software development • But, usingexisting transformations with product lines is a challenge • Possible solutions • Always apply transformation after configuration • extra maintenance, lose analysis capability • Apply transformation to all products and merge • expensive • Manually redevelop transformation for product line • high effort and error prone • Our solution: automated lifting of transformation to product line • lifting reinterprets transformation execution semantics Lifting Transformations to Product Lines
Summary Cont’d • Preliminary evaluation shows a clear benefit • Automation eliminates effort and potential for error • Lifted transformations are slower but orders of magnitude faster than applying to all products • Scales well with increasing feature model size Lifting Transformations to Product Lines
Next Steps • More extensive evaluation • Extending the approach • To richer transformation languages • with control flow • pragmatic transformation languages (e.g., ATL) • To richer product line languages • E.g., Common Variability Language Lifting Transformations to Product Lines
Thank you Lifting Transformations to Product Lines