Aucun titre de diapositive

configuration information intermingled .... By limiting the range of variants available from a given Concrete Factory: ... Class Diagram Handling. Message.
332KB taille 3 téléchargements 377 vues
Product Line Engineering : Product Derivation in an MDA framework

Tewfik Ziadi Jean-Marc Jézéquel Frédéric Fondement

WP3 – Task 3.3

MDA and PLE : a Vision

PIM

Aspect1

PIM

PLE



Aspectn

PIM

PS Aspect

PSM

Aspectk

12/09/2003 – 14h35

MDA

PSM 2

WP3 – Task 3.3

Aspect weaving is The unifying paradigm ! MDA is mainly useful in a PLE context

Product derivation in a Product Line: Executive Summary „ The analysis model has identified the variants between products (including Platform specificities) „

Reified as language-level classes (inheritance, …)

„

Decorated with OCL meta-level constraints

„ Systematic use of the Abstract Factory pattern „

To specify a product among the family

„ Model Transformations (at the meta-model level) to automatically derive a product Using OCL2

12/09/2003 – 14h35

„

3

WP3 – Task 3.3

The 3 Dimensions of Software Configuration Management : [Estublier et al. 95] The Variant dimension „ Handle environmental differences

The revision dimension „ Evolution over time

The concurrent activities dimension „ Many developers are authorized to modify the same configuration item

12/09/2003 – 14h35

Even with the help of sophisticated tools, the complexity might be daunting Try to simplify it by reifying the variants of an OO system

4

WP3 – Task 3.3

Traditional Approaches Patch the executable „ Device drivers „

Source level, link time, boot time, on demand at runtime

„ Static configuration table „ Conditional Compilation / Runtime Tests

12/09/2003 – 14h35

If (language == french) { #ifdef MSW io_puts(0, ‘‘Bonjour’’, 7); #elseif TEXT printf(‘‘Bonjour\n’’); #endif } else { #ifdef MSW io_puts(0, ‘‘Hello’’, 5); #elseif TEXT printf(‘‘Hello\n’’); #endif

5

WP3 – Task 3.3





Static and Dynamic configuration information intermingled Hard to change your mind on what should be static or dynamic…

Basic Idea Abstract the Intent

„ Io.write_line(language.hello) Rely on Dynamic Binding for the Details < < A bs tr ac t> > IO

< < A bs trac t> > Language

writeLi ne( )

12/09/2003 – 14h35

MSW

Hello () : S trin g

T EXT

Frenc h

B as ic

Uncouple the variations from the selection process

„ Automatically derive a product using OCL2 metamodel transformation 6

WP3 – Task 3.3

Case Study: The Mercure Product Line Engine 1

1 1 Mercure 1 1



Engine

Engine N

1... Net Driver

Net Driver 1

1

1..*

1..*



1..* Manager 1..*

43,980,465,111,040 possible variants

Net Driver N

*

observe

{Presence constraint}

1..*

buffers

Message

Manager 1



Manager N 1..2

+... 1..* GUI

12/09/2003 – 14h35

1

+Use

+available 1..* 1 Language

GUI 1



GUI N LanguageCat 1

Language Cat 2

7

WP3 – Task 3.3

{Mutual exclusion}

Language 1-1

… Language 1-N Language 2-1

… Language 2-N

Exemples of Constraints at the PLA Level Inheritance constraint „ Optional classes in Product Line Architecture can be omitted in certain products so a non-optional class cannot inherit from an optional one. „ OCL expression (at the M2 level): „

context Generalization inv self.parent.isStereotyped(“optional”) implies self.child.isStereotyped(“optional”)

Dependency constraint „ Idem 12/09/2003 – 14h35

„

8

context Dependency inv self.supplier->exists( S:ModelElement | .isStereotyped(“optional”)) implies self.client->forAll( C:ModelElement | C.isStereotyped(“optional”) )

WP3 – Task 3.3

Constraints specific to a given PLA Presence constraint. „ To express in a specific SPLA that the presence of the optional class C1 requires the presence of C2, we add the following OCL meta-model constraint. „

context Model inv presenceClass(‘C1’) implies presenceClass(‘C2’)

Mutual Exclusion constraint. „ To express in a specific SPLA that two optional classes cannot be present in the same Product, we add the following OCL meta-model constraint. context Model inv (presenceClass(‘C1’) implies not presenceClass(‘C2’)) and (presenceClass(‘C2’) implies not presenceClass(‘C1’))

12/09/2003 – 14h35

„

9

WP3 – Task 3.3

Reifying the Variants call_back

Mercure_Factory

1 1

FullMercure

makes

1

Mercure 1

MinMercure

CustomMercure

CustomMercure

12/09/2003 – 14h35

new_gui() : GUI Dynamic binding replaced with direct call (and even in lining)

When more than one living class z

Dynamic binding (or replaced by if then … else)

12/09/2003 – 14h35

Implemented in SCM context using compilation – GNU SmallEiffel

12

„ “Reifying variants in configuration management” J.ML. Jézéquel. ACM Transactions on Software Engineering and Methodology, July 1999. Using OCL2 & UMLAUT framework WP3 – Task 3.3

Using OCL2

forAll op in Operation.allInstances() {

12/09/2003 – 14h35

-- The returned type of the operation determines the used variants Class opReturnType := (op.parameter->select(p:Parameter|p.kind = #return)).type

13

if opReturnType.isAbstract then –- For multiple choice, we use stereotypes to specify the -- selected variants forAll st in op.stereotype { selectVariant(st.name) } else –- Here, we directly get the selected variant selectVariant(opReturnType.name) endif }

WP3 – Task 3.3

Class Diagram Handling Engine 1

1 1 Mercure 1 1



Engine

Engine N

1... Net Driver

Net Driver 1

1..*

Net Driver N

1

1..*

1..* Manager 1..*

new_gui() : GUI