Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

47
Variability Modelling in the ABS Language Dave Clarke Katholieke Universiteit Leuven based on joint work with José Proença, Michiel Helvenstijen, Ina Schaefer, Radu Muschevici Tuesday 1 March 2011

Transcript of Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Page 1: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Variability Modelling in the ABS Language

Dave ClarkeKatholieke Universiteit Leuven

based on joint work with José Proença, Michiel Helvenstijen,

Ina Schaefer, Radu Muschevici

Tuesday 1 March 2011

Page 2: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Outline

• Introduction

• Feature Modelling

• Delta Modelling

• Product Line Configuration

• Feature Selection

• Product Generation

• Conclusion

Tuesday 1 March 2011

Page 3: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Outline

• Feature Modelling

• Delta Modelling

• Product Line Configuration

• Feature Selection

• Product Generation

• Conclusion

Introduction

Tuesday 1 March 2011

Page 4: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Product Line Development

Feature Model Family Engineering

Product Line Artefacts Base

Application EngineeringFeature Selection Product

Tuesday 1 March 2011

Page 5: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Running Example

Tuesday 1 March 2011

Page 6: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Running Example:Multi-lingual Hello World• English: “Hello World”

• German: “Hallo Welt”

• Dutch: “Hallo Wereld”

• Swedish: “Hejsan Allihopa”

• French: “Bonjour tout le monde”

• Possibly with repetition

Tuesday 1 March 2011

Page 7: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Ingredients of Variability in ABS

• Core ABS

• Feature Model (µTVL) – describing variability

• Deltas – implementing variability

• Configuration Language

• Feature Selection Language

Tuesday 1 March 2011

Page 8: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

The Core Functionality

Tuesday 1 March 2011

Page 9: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

The Core

interface Greeting { String say_hello();}

class Greeter implements Greeting { String say_hello() { return "Hello world"; }}

English by default

A fully functioning application(minus main)

Tuesday 1 March 2011

Page 10: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Outline

• Introduction

• Delta Modelling

• Product Line Configuration

• Feature Selection

• Product Generation

• Conclusion

Feature Modelling

Tuesday 1 March 2011

Page 11: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Product Line Development

Feature Model Family Engineering

Product Line Artefacts Base

Application EngineeringFeature Selection Product

Tuesday 1 March 2011

Page 12: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Feature Models

I18n

Repeattimes:[1,1000]

GermanFrench

English

SwedishRepeat → (times ≥ 2

&& times ≤ 5)

Or CardinalitiesExcludesRequires

Optional

Alternative

ConstraintsAttributes

And

Tuesday 1 March 2011

Page 13: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Feature Model in µTVLsroot I18n { group allof { Language { group oneof { English, Dutch, French, German, Swedish } }, opt Repeat { int [0,1000] times; } }}

extension English { ifin: Repeat ->

(Repeat.times >= 2 && Repeat.times <= 5);}

Tuesday 1 March 2011

Page 14: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

µTVL Feature Modelling Language

• µTVL adapts existing TVL language [Claessen, FUNDP, Namur U]

• Constraint solver written in Choco:

• finds valid feature selections matching specified constraints

• checks validity of feature selections

Tuesday 1 March 2011

Page 15: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Outline

• Introduction

• Feature Modelling

• Product Line Configuration

• Feature Selection

• Product Generation

• Conclusion

Delta Modelling

Tuesday 1 March 2011

Page 16: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Delta-oriented Programming

Feature Model Family Engineering

Product Line Artefacts Base

Application EngineeringFeature Selection ProductAutomated Product

Derivation

Core Products –complete product for some feature configuration

Product Deltas –additions, removals, modifications to core product

Tuesday 1 March 2011

Page 17: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Delta-oriented Programming

• Modifications on Class Level:

• Addition, Removal and Modification of Classes

• Modifications of Class Structure:

• Changing Super Class and Constructor

• Adding/Removing Fields/Methods

• Modifying Methods (wrapping original call)

- [Delta-oriented Programming of Software Product Lines Schaefer, Bettini, Bono, Damiani, Tanzarella. SPLC 2010.]

Tuesday 1 March 2011

Page 18: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

The Repeat Delta

delta Rpt (Int times) { modifies Greeter { modifies String say_hello() { String result = ""; Int i = 0; while (i < times) { result = result + original(); i = i + 1; } return result; } }}

Tuesday 1 March 2011

Page 19: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

The German Delta

delta De { modifies Greeter { modifies String say_hello() { return "Hallo Welt"; } }}

Tuesday 1 March 2011

Page 20: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

The Dutch Delta

delta Nl { modifies Greeter { modifies String say_hello() { return "Hallo wereld"; } }}

Tuesday 1 March 2011

Page 21: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

The French Delta

delta Fr { modifies Greeter { modifies String say_hello() { return "Bonjour tout le monde"; } }}

Tuesday 1 March 2011

Page 22: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

The Swedish Delta

delta Sv { modifies Greeter { modifies String say_hello() { return "Hejsan allihopa"; } }}

Tuesday 1 March 2011

Page 23: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Outline

• Introduction

• Feature Modelling

• Delta Modelling

• Feature Selection

• Product Generation

• Conclusion

Product Line Configuration

Tuesday 1 March 2011

Page 24: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Features-Delta Mapping

Deltas

Core

Artefacts

Feature Model

Configuration

application conditions & delta ordering

Tuesday 1 March 2011

Page 25: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Configuration

• Links feature model with deltas

• Adds application conditions to deltas:

• constraints on features and attributes

• Specifies ordering between deltas

• Nests deltas to ensure atomic application

Tuesday 1 March 2011

Page 26: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Configuration

product line HelloMultiLingual { features Repeat, German, French, Dutch, Swedish; core English;

delta De when German && not Repeat; delta Fr when French; delta Nl when Dutch; delta Sv when Swedish && Repeat; delta Rpt(Repeat.times) after De, Fr, Nl, Sv when Repeat;}

parameter passing

ordering

application conditions

Tuesday 1 March 2011

Page 27: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Outline

• Introduction

• Feature Modelling

• Delta Modelling

• Product Line Configuration

• Product Generation

• Conclusion

Feature Selection

Tuesday 1 March 2011

Page 28: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Product Line Development

Feature Model Family Engineering

Product Line Artefacts Base

Application EngineeringFeature Selection Product

Tuesday 1 March 2011

Page 29: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Feature Selection

Deltas

Core

Artefacts

Feature Model

Configuration

Satisfies

Product

Uses Uses

Generates

Feature Selection

Tuesday 1 March 2011

Page 30: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Feature Selection

• Specifies selected features and their attributes.

• Final Ingredient required to Generate Product.

• Checked against Feature Model.

Tuesday 1 March 2011

Page 31: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Feature Selection

// basic product with no deltasproduct P1 { Greeting bob; bob = new Greeter(); String s = ""; s = bob.say_hello();}

} Initialisation (aka main)

Tuesday 1 March 2011

Page 32: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Feature Selection

// apply delta Fr and Repeatproduct P3 (French, Repeat{times=10}) { Greeting bob; bob = new Greeter(); String s = ""; s = bob.say_hello();}

Attribute SpecificationFeature Selection

Tuesday 1 March 2011

Page 33: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Outline

• Introduction

• Feature Modelling

• Delta Modelling

• Product Line Configuration

• Feature Selection

• ConclusionProduct Generation

Tuesday 1 March 2011

Page 34: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Product Line Development

Feature Model Family Engineering

Product Line Artefacts Base

Application EngineeringFeature Configuration Product

Tuesday 1 March 2011

Page 35: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Product Generation

• For a Feature Configuration:

• Select product deltas with valid application condition

• Determine linear ordering of product deltas compatible with partial ordering

• Apply changes specified by product deltas to core product in the linear order

Tuesday 1 March 2011

Page 36: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Given Feature Selection

// apply delta Fr and Repeatproduct P3 (French, Repeat{times=10}) { Greeting bob; bob = new Greeter(); String s = ""; s = bob.say_hello();}

Tuesday 1 March 2011

Page 37: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Apply Delta Frclass Greeter implements Greeting { String say_hello() { return "Hello world"; }}

delta Fr { modifies Greeter { modifies String say_hello() { return "Bonjour tout le monde"; } }}

+

Tuesday 1 March 2011

Page 38: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Apply Delta Fr

class Greeter implements Greeting { String say_hello() { return "Bonjour tout le monde"; }}

Tuesday 1 March 2011

Page 39: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Configure Repeat

delta Rpt (Int times) { modifies Greeter { modifies String say_hello() { String result = ""; Int i = 0; while (i < times) { result = result + original(); i = i + 1; } return result; } }}

times=10

Tuesday 1 March 2011

Page 40: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Configure Repeat

delta Rpt { modifies Greeter { modifies String say_hello() { String result = ""; Int i = 0; while (i < 10 ) { result = result + original(); i = i + 1; } return result; } }}

Tuesday 1 March 2011

Page 41: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Apply Repeat

delta Rpt { modifies Greeter { modifies String say_hello() { String result = ""; Int i = 0; while (i < 10) { result = result + original(); i = i + 1; } return result; } }}

class Greeter implements Greeting { String say_hello() { return "Bonjour tout le monde"; }}

+

Tuesday 1 March 2011

Page 42: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Apply Repeatclass Greeter implements Greeting { String __say_hello_original() { return "Bonjour tout le monde"; }

String say_hello() { String result = ""; Int i = 0; while (i < 10) { result = result + __say_hello_original(); i = i + 1; } return result; }}

Tuesday 1 March 2011

Page 43: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Adding Initialisationclass Greeter implements Greeting { String __say_hello_original() { return "Bonjour tout le monde"; }

String say_hello() { String result = ""; Int i = 0; while (i < 10) { result = result + __say_hello_original(); i = i + 1; } return result; }}{ Greeting bob; bob = new Greeter(); String s = ""; s = bob.say_hello();}

Tuesday 1 March 2011

Page 44: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Typing Issues

• Errors

• Field, method, class missing

• Incorrect type: field/method

• Warnings

• Field/method/class not expected one

• Conflicting implementation orderings

• Product line level checking instead of per product (= after generation) checking

Tuesday 1 March 2011

Page 45: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Outline

• Introduction

• Feature Modelling

• Delta Modelling

• Product Line Configuration

• Feature Selection

• Product Generation

• ConclusionTuesday 1 March 2011

Page 46: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

HATS ABS

• HATS ABS is a collection of 5 languages

• Core Product

• Product Deltas

• Feature Modelling

• Configuration: Links FM and Core+Deltas

• Feature Selection

• Implementation efforts are well underway

Tuesday 1 March 2011

Page 47: Dave Clarke (KU Leuven): Variability Modelling in the ABS Language

Questions?

Tuesday 1 March 2011