university of toronto department of computer science lifting transformations to product lines rick...

37
University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay , Michalis Famelis, Julia Rubin, Alessio Di Sandro, Marsha Chechik

Upload: noreen-reed

Post on 05-Jan-2016

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

University of TorontoDepartment of Computer Science

Lifting Transformations to Product Lines

Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro, Marsha Chechik

Page 2: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

Product lines

+Dry +Dry/Delay

+Delay+Heat

Manage a large number of similar but different artifact variants (products)

Washing Machine Co.

2 Lifting Transformations to Product Lines

Page 3: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

Product line structure

+Dry +Dry/Delay

+Delay+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.

Feature Model

Wash

Heat

Dry

Delay

excludes

Domain Model

3 Lifting Transformations to Product Lines

Page 4: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

Product line configuration – example 1

+Dry +Dry/Delay

+Delay+Heat

+Heat product Feature configuration: {Wash, Heat}

Washing Machine Co.Feature Model

Wash

Heat

Dry

Delay

excludes

+Heat

4 Lifting Transformations to Product Lines

Page 5: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

Product line configuration – example 2

+Dry +Dry/Delay

+Delay+Heat

+Dry/Delay product Feature configuration: {Wash, Dry, Delay}

Washing Machine Co.Feature Model

Wash

Heat

Dry

Delay

excludes

+Dry/

Delay

5 Lifting Transformations to Product Lines

Page 6: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

Domain Model

Model product line:washing machine state machine

Locking Waiting

Washing

entry/TempCheck()

Drying

Unlocking

[heatEnabled;delayEnabled]/ HeaterOn()

/ HeaterOff(); wash.Start();

/ QuickCool()

/ QuickCool()

[not heatEnabled;not delayEnabled]/ wash.Start();

Presence Conditions

Feature Model

Wash

Heat

Dry

Delay

excludes

6 Lifting Transformations to Product Lines

Heat Delay

Heat

Heat

Heat

Heat

DryDry

DryDry

Heat Delay

Page 7: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

Domain Model

Feature Model

Configuring a model (product)

Locking Waiting

Washing

entry/TempCheck()

Drying

Unlocking

[heatEnabled;delayEnabled]/ HeaterOn()

/ HeaterOff(); wash.Start();

/ QuickCool()

/ QuickCool()

[not heatEnabled;not delayEnabled]/ wash.Start();

Wash

Heat

Dry

Delay

excludes

Heat Delay

Heat

Heat

Heat

Heat

DryDry

DryDry

7 Lifting Transformations to Product Lines

Heat Delay

Page 8: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

+Dry/Delay Variant

+Dry/Delay state machine

Locking Waiting

Washing

Drying

Unlocking

[ delayEnabled]

/ wash.Start();

/ QuickCool()

8 Lifting Transformations to Product Lines

[ not delayEnabled]/ wash.Start();

Page 9: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

+Dry/Delay Variant

+Dry/Delay state machine

Locking Waiting

Washing

Drying

Unlocking

[delayEnabled]

/wash.Start();

/ QuickCool()

9 Lifting Transformations to Product Lines

[not delayEnabled]/ wash.Start();

Page 10: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

Outline Product lines Transformations Why lift transformations to product lines? Sketch of lifting algorithm Evaluation Summary and next steps

10 Lifting Transformations to Product Lines

Page 11: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

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

Transformations in Model Driven Engineering (MDE)

WideYellow

11 Lifting Transformations to Product Lines

Page 12: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

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?

ModelModel

Our goal

?

Model ModelModel

Model Product

Line

configure

configure

12 Lifting Transformations to Product Lines

Page 13: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

+Dry +Dry

Idea 1 – Avoid lifting transformation

Wash

Heat

Dry

Delay

excludes

WideYellow

configure

Problems: Must keep track of transformations to apply Can’t do analysis of transformation’s effect on product

line 13 Lifting Transformations to Product

Lines

Page 14: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

+Dry

+Dela

y

Idea 2: Configure all products and merge

Wash

Heat

Dry

Delay

excludes

Wash

Heat

Dry

Delay

excludes

configure

merge

+Dela

y

+Dry

WideYellow

WideYellow

WideYellow

Problems: Expensive: may be many products! Merge is non-trivial

14 Lifting Transformations to Product Lines

Page 15: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

WideYellow

ManualLift

Idea 3: Manually lift by re-developing transformation

Wash

Heat

Dry

Delay

excludes

Wash

Heat

Dry

Delay

excludes

Problems: Requires extensive effort Error-prone

15 Lifting Transformations to Product Lines

Page 16: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

Automated

Lift

Our contribution: Automate the lift

Wash

Heat

Dry

Delay

excludes

WideYellow

Wash

Heat

Dry

Delay

excludes

16 Lifting Transformations to Product Lines

Benefits Low cost Eliminates manual effort Guarantees correctness

Page 17: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

Outline Product lines Transformations Why lift transformations to product lines? Sketch of lifting algorithm Evaluation Summary and next steps

17 Lifting Transformations to Product Lines

Page 18: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

Example: State machine refactoring transformation

NAC

Applicability Condition: Apply the rule if the LHS matches and no NAC matches

18 Lifting Transformations to Product Lines

Negative Application Condition

Page 19: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

Applying FoldEntry – example 1

FoldEntry

NAC

+Dry/Delay Variant

Locking Waiting

Washing

/wash.Start();

Drying

Unlocking

[delayEnabled]

/ QuickCool()

19 Lifting Transformations to Product Lines

[not delayEnabled]/ wash.Start();

Matching Site

No NAC matches – applicability condition passes Apply rule

Page 20: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

Applying FoldEntry – example 1

FoldEntry

NAC

+Dry/Delay Variant

Locking Waiting

Washing

entry/ wash.Start();

Drying

Unlocking

[delayEnabled]

/ QuickCool()

20 Lifting Transformations to Product Lines

[not delayEnabled]

Page 21: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

Applying FoldEntry – example 2

FoldEntry

NAC

+Heat Variant

Locking Waiting

Washing

entry/TempCheck()

Unlocking

[heatEnabled]/ HeaterOn()

/ HeaterOff(); wash.Start();

/ QuickCool()

21 Lifting Transformations to Product Lines

[not heatEnabled]/ wash.Start();

NAC Matches – applicability condition fails Do not apply rule

Matching Site

Page 22: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

Domain Model

Feature ModelHow to apply FoldEntry to a Product Line?

Locking Waiting

Washing

entry/TempCheck()

Drying

Unlocking

[heatEnabled;delayEnabled]/ HeaterOn()

/ HeaterOff(); wash.Start();

/ QuickCool()

/ QuickCool()

Wash

Heat

Dry

Delay

excludes

Heat Delay

Heat

Heat

Heat

Heat

DryDry

DryDry

22 Lifting Transformations to Product Lines

Heat Delay[not heatEnabled;not

delayEnabled]/ wash.Start();

Page 23: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

Lifting algorithm sketch

1. Find matching sites in the domain model

2. Reinterpret rule applicability condition Rule must be applicable in at least

one product requires SAT check

3. Reinterpret how to apply the rule Modify domain model and presence

conditions so rule effect only occurs in applicable products

24 Lifting Transformations to Product Lines

Page 24: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

Lifting Transformations to Product Lines

25

Domain Model

Locking Waiting

Washing

entry/TempCheck()

Drying

Unlocking

[heatEnabled;delayEnabled]/ HeaterOn()

/ HeaterOff(); wash.Start();

/ QuickCool()

/ QuickCool()

Feature Model

Wash

Heat

Dry

Delay

excludes

Heat

+Dry/Delay Variant

Locking

Waiting

Washing

/wash.Start();

Drying

Unlocking

[delayEnabled]

/ QuickCool()

/ wash.Start();

+Dry/Delay Variant

+Heat VariantLocki

ngWaiti

ng

Washing

entry/TempCheck()

Unlocking

[heatEnabled]/ HeaterOn()

/ HeaterOff(); wash.Start();/

QuickCool()

/ wash.Start(); +Heat Variant

Heat

Dry

Heat

Heat Delay

Heat

DryDry

Dry

Heat Delay[not heatEnabled;not

delayEnabled] /wash.Start();

1) Matching Site

2) Lifted rule applicability condition passes Apply rule

2) Rule applicable in at least one product?

Page 25: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

26 Lifting Transformations to Product Lines

Domain Model

Locking Waiting

Washing

entry/TempCheck();

wash.Start();Drying

Unlocking

[heatEnabled;delayEnabled]/ HeaterOn()

/ HeaterOff(); wash.Start();

/ QuickCool()

/ QuickCool()

Heat3) Apply rule domain model and update presence conditions

Delay

Feature Model

Wash

Heat

Dry

Delay

excludes

+Dry/Delay Variant

Locking

Waiting

Washing

/wash.Start();

Drying

Unlocking

[delayEnabled]

/ QuickCool()

/ wash.Start();

+Dry/Delay Variant

+Heat VariantLocki

ngWaiti

ng

Washing

entry/TempCheck()

Unlocking

[heatEnabled]/ HeaterOn()

/ HeaterOff(); wash.Start();/

QuickCool()

/ wash.Start(); +Heat Variant

[not heatEnabled;not delayEnabled]

/wash.Start();

Page 26: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

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

27 Lifting Transformations to Product Lines

Page 27: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

Outline Product lines Transformations Why lift transformations to product lines? Sketch of lifting algorithm Evaluation Summary and next steps

29 Lifting Transformations to Product Lines

Page 28: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

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)

Henshin Graph Transformation Engine (modified)

Eclipse WorkbenchEclipse Workbench Z3 SMT SolverZ3 SMT Solver

Model Management Tool Framework(MMTF)

Model Management Tool Framework(MMTF)

30 Lifting Transformations to Product Lines

Page 29: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

Application: Car Crash Management Product Line

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)

31 Lifting Transformations to Product Lines

Objective: Illustrate lifting on a more realistic scenario

Page 30: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

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

Class to Relational

Time/App(msec)

Classical 2.6

Lifted 288.6

Slowdown 128.5

AddGet Time/App (msec)

Classical 0.5

Lifted 12.5

Slowdown 27.7

Some slowdown but much better

than applying to all 15,360

products!

32 Lifting Transformations to Product Lines

Page 31: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

Scalability Study (RQ) How does lifted rule execution time scale with:

1. Size of product line (# of features)2. 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

33 Lifting Transformations to Product Lines

Page 32: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

Results – time vs. features

# of matchelements

34 Lifting Transformations to Product Lines

4

12

1339

2025

37

Time seems to increase with rule size and then suddenly drops!

Time increase close to linear with # of features

Page 33: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

Results - # UNSAT vs. features

35 Lifting Transformations to Product Lines

# of matchelements

4

1239

20

25

37

13

Reason: larger rules have more fast UNSAT results

Page 34: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

Summary Product lines and transformations help manage

software development But, using existing 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

36 Lifting Transformations to Product Lines

Page 35: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

Summary Cont’d

Lifting Transformations to Product Lines

37

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

Page 36: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

Next Steps

More extensive evaluation Extending the approach

To richer transformation languageswith control flowpragmatic transformation languages

(e.g., ATL) To richer product line languages

E.g., Common Variability Language

38 Lifting Transformations to Product Lines

Page 37: University of Toronto Department of Computer Science Lifting Transformations to Product Lines Rick Salay, Michalis Famelis, Julia Rubin, Alessio Di Sandro,

Thank you

Lifting Transformations to Product Lines

39