Modeling Variability V ARIETE , DFF S APERE A UDE Andrzej W - - PowerPoint PPT Presentation

modeling variability v ariete dff s apere a ude andrzej w
SMART_READER_LITE
LIVE PREVIEW

Modeling Variability V ARIETE , DFF S APERE A UDE Andrzej W - - PowerPoint PPT Presentation

DSM-TP 2016 Modeling Variability V ARIETE , DFF S APERE A UDE Andrzej W asowski PROCESS AND SYSTEM MODELS GROUP Drowning in Clone-And-Own blue.cc blue.cc blue.cc ? CHANGE BUG FOUND INDEPENDENT INDEPENDENTLY BUG FIXES blue.cc


slide-1
SLIDE 1

DSM-TP 2016

Modeling

Variability

Andrzej W ˛ asowski

VARIETE, DFF SAPERE AUDE

PROCESS AND SYSTEM MODELS GROUP

slide-2
SLIDE 2

Drowning in Clone-And-Own

blue.cc blue.cc CHANGE blue.cc green.cc green.cc blue.cc green.cc BUG FOUND INDEPENDENTLY INDEPENDENT BUG FIXES

?

c Andrzej W ˛ asowski, IT University of Copenhagen 2

slide-3
SLIDE 3

Opportunistic Reuse Does Not Work

◮ Common scenario:

version the code, reuse when opportunity appears

◮ If the file to be reused needs change, copy it

You clone-and-own it

◮ Benefit from quickly available functionality ◮ But have to test, debug, change and

evolve the file yourself

◮ Product specific code grows ◮ Platform code diminishes

and degrades

shared platform code product code product code product code product code build system build system build system build system

c Andrzej W ˛ asowski, IT University of Copenhagen 3

slide-4
SLIDE 4

SUCCESSFUL REUSE IS PROACTIVE PLANNED MANAGED

c Andrzej W ˛ asowski, IT University of Copenhagen 4

slide-5
SLIDE 5

AGENDA

◮ SPL Method, Architecture ◮ Variability Implementation Spectrum ◮ Variability Abstraction: Feature Modeling ◮ Variability Modeling in Practice ◮ Variability Realization

c Andrzej W ˛ asowski, IT University of Copenhagen 5

slide-6
SLIDE 6

Domain vs Application Processes

Pohl et. al. Software Product Line Engineering

c Andrzej W ˛ asowski, IT University of Copenhagen 6

slide-7
SLIDE 7

A Simple Product Line Architecture

variability realization variability abstraction build system

# # CPUFreq processor drivers # CONFIG_X86_PCC_CPUFREQ=m CONFIG_X86_ACPI_CPUFREQ=y CONFIG_X86_POWERNOW_K6=y CONFIG_X86_POWERNOW_K7=y CONFIG_X86_POWERNOW_K7_ACPI=y CONFIG_X86_POWERNOW_K8=y CONFIG_X86_GX_SUSPMOD=y CONFIG_X86_SPEEDSTEP_CENTRINO=y CONFIG_X86_SPEEDSTEP_CENTRINO_TABLE=y CONFIG_X86_SPEEDSTEP_ICH=y CONFIG_X86_SPEEDSTEP_SMI=y CONFIG_X86_P4_CLOCKMOD=m CONFIG_X86_CPUFREQ_NFORCE2=y CONFIG_X86_LONGRUN=y CONFIG_X86_LONGHAUL=y CONFIG_X86_E_POWERSAVER=m

variability resolution

conforms configured against core assets platform product specific assets

◮ Less product specific = more reuse: development/tests/debugging/build ◮ Model of commonality and variability. ◮ Scope under control. Explicit feature life cycle

c Andrzej W ˛ asowski, IT University of Copenhagen 7

slide-8
SLIDE 8

Exploit commonality Manage variability

c Andrzej W ˛ asowski, IT University of Copenhagen 8

slide-9
SLIDE 9

AGENDA

◮ SPL Method, Architecture ◮ Variability Implementation Spectrum ◮ Variability Abstraction: Feature Modeling ◮ Variability Modeling in Practice ◮ Variability Realization

c Andrzej W ˛ asowski, IT University of Copenhagen 9

slide-10
SLIDE 10

Spectrum of Variability Architectures

Stay as close to the left as possible

property & configuration files + build system feature models + build system feature models + product specific code domain specific languages + code generation frameworks + framework completion code

  • nly product specific code (no reuse)

c Andrzej W ˛ asowski, IT University of Copenhagen 10

slide-11
SLIDE 11

Implementation Technologies

◮ Variability abstraction: FMs, DSLs, or none ◮ Variability resolution:

XML property file FM configuration Domain specific model (DSM)

◮ Variability realization:

general purpose code w/ variability techniques code generators model transformers parts may use DSLs etc.

variability realization variability abstraction build system

# # CPUFreq processor drivers # CONFIG_X86_PCC_CPUFREQ=m CONFIG_X86_ACPI_CPUFREQ=y CONFIG_X86_POWERNOW_K6=y CONFIG_X86_POWERNOW_K7=y CONFIG_X86_POWERNOW_K7_ACPI=y CONFIG_X86_POWERNOW_K8=y CONFIG_X86_GX_SUSPMOD=y CONFIG_X86_SPEEDSTEP_CENTRINO=y CONFIG_X86_SPEEDSTEP_CENTRINO_TABLE=y CONFIG_X86_SPEEDSTEP_ICH=y CONFIG_X86_SPEEDSTEP_SMI=y CONFIG_X86_P4_CLOCKMOD=m CONFIG_X86_CPUFREQ_NFORCE2=y CONFIG_X86_LONGRUN=y CONFIG_X86_LONGHAUL=y CONFIG_X86_E_POWERSAVER=m

variability resolution

conforms configured against core assets platform

c Andrzej W ˛ asowski, IT University of Copenhagen 11

slide-12
SLIDE 12

AGENDA

◮ SPL Method, Architecture ◮ Variability Implementation Spectrum ◮ Variability Abstraction: Feature Modeling ◮ Variability Modeling in Practice ◮ Variability Realization

c Andrzej W ˛ asowski, IT University of Copenhagen 12

slide-13
SLIDE 13

Problem Space Solution Space

SMS notification on transaction paid services SMSLoggerAspect Phone No. in data model

features variation points

invoice code.cs

int sort (int[] A, comp ope) { if (A == null) return -1; for (int i = 0; i < A.size(); I++) { print (A[i].toString()); } }

c Andrzej W ˛ asowski, IT University of Copenhagen 13

slide-14
SLIDE 14

CVL Architecture for Dummies

The degree of coupling can be controlled by moving the mapping Variability Abstraction Variability Realization Base (model) Feature/Decision Models Feature Mapping Source Code

c Andrzej W ˛ asowski, IT University of Copenhagen 14

CVL submitters. Common Variability Language, OMG Revised Submission. 2012

slide-15
SLIDE 15

Feature Modeling (I)

feature: a single variability increment in the problem domain (decision) variation point: a single variability increment in the solution space

c Andrzej W ˛ asowski, IT University of Copenhagen 15

slide-16
SLIDE 16

Feature Modeling (II)

Example from Czarnecki’02

mandatory pulls trailer engine body car electric gasoline automatic manual

  • ptional

exclusive choice inclusive choice transmission

◮ Hierarchy constraints, for example:

manual requires transmission (each child node requires its parent node)

◮ Groups constraints: engine is electric or gas driven or both ◮ Not all constraints in hierarchy & groups, cross-tree constraints in text:

electric requires automatic

◮ Attributes are added like to classes (eg. engine volume)

c Andrzej W ˛ asowski, IT University of Copenhagen 16

slide-17
SLIDE 17

Feature Modeling (III)

Configuration

mandatory pulls trailer engine body car electric gasoline automatic manual

  • ptional

exclusive choice inclusive choice transmission

electric requires automatic

+ + + + + + +

c Andrzej W ˛ asowski, IT University of Copenhagen 17

slide-18
SLIDE 18

Feature Models (IV)

An example meta-model from Janota’08

Feature Root Feature Grouped Feature Solitary Feature Group 2..* 1 0..* Sub-feature Relation Type Mandatory Sub-feature Optional Sub-feature XOR-group OR-group 1 1 0..* is sub-feature

meta-model (abstract syntax)

◮ Note a single generic kind of relations: subfeature ◮ No distinction between kind-of (inheritance) and part-of (containment),

like class modeling does

◮ A characteristic feature of configuration and constraint languages

(as opposed to structural modeling languages)

◮ Clafer (as a structural modeling langauge) supports the distinction,

but so do other feature modeling languages

c Andrzej W ˛ asowski, IT University of Copenhagen 18

slide-19
SLIDE 19

Feature Modeling and FODA

Feature Oriented Design and Analysis by Kang et al. 1990

◮ FODA succeeds for its simplicity ◮ Probably best intro in Czarnecki’s Generative Programming (Chpt. 4) ◮ 3950+ citations, never formally published

c Andrzej W ˛ asowski, IT University of Copenhagen 19

slide-20
SLIDE 20

Feature Modeling vs Class Modeling

A feature model in Product Variant Master Notation (Hvam)

A feature model A roughly equivalent class diagram

More on this: B ˛

  • ak. Czarnecki. W ˛
  • asowski. Feature and Meta-Models in Clafer: Mixed, Specialized,

and Coupled. SLE 2010 Above models from: Haug. Degn. Poulsen. Hvam. Creating a documentation system to support the development and maintenance of product configuration systems

c Andrzej W ˛ asowski, IT University of Copenhagen 20

slide-21
SLIDE 21

Applications of Feature Models

Design & Management

domain modeling product line scoping product line mngmt code generation driving build system driving testing

Development & Test

c Andrzej W ˛ asowski, IT University of Copenhagen 21

slide-22
SLIDE 22

How To Build Feature Models?

Two strategies, but only one good :)

◮ Big-bang adoption ◮ Perform careful domain

analysis

◮ Document concepts,

abstractions and relations between them in a FM

top-down

◮ Identify a cloned component ◮ Find the patches that describe

differences

◮ Translate diffs to variation

points

◮ Organize variation points into

features, and a hierarchy

◮ Works well with incremental

adoption

◮ See SPLC07 paper by Danfoss

bottom-up

c Andrzej W ˛ asowski, IT University of Copenhagen 22

Hans Peter Jepsen, Jan Gaardsted Dall, Danilo Beuche. Minimally Invasive Migration to Software Product

  • Lines. SPLC 2007
slide-23
SLIDE 23

AGENDA

◮ SPL Method, Architecture ◮ Variability Implementation Spectrum ◮ Variability Abstraction: Feature Modeling ◮ Variability Modeling in Practice ◮ Variability Realization

c Andrzej W ˛ asowski, IT University of Copenhagen 23

slide-24
SLIDE 24

Variability Modeling is The Success Story of Modeling

c Andrzej W ˛ asowski, IT University of Copenhagen 24

slide-25
SLIDE 25
slide-26
SLIDE 26
slide-27
SLIDE 27

A Laboratory Feature Model

c Andrzej W ˛ asowski, IT University of Copenhagen 27

Czarnecki, W ˛

  • asowski. Feature Diagrams and Logics: There and Back Again. In: 11th International

Software Product Line Conference (SPLC 2007) Kyoto, Japan, 10-14 September, 2007 c IEEE Press.

slide-28
SLIDE 28

A Healthy Wild Feature Model Cub

ToyBox project, 71 features

ONEIT GEN DIRNAME PIPES MKFIFO PATCH F TTY ToyBox Global settings Toys TOYSH FLOWCTL CD EXIT P QUOTES BUILTINS TTY BASENAME UNAME MKSWAP LOCALS ARRAYS JOBCTL BZCAT SLEEP CKSUM CHROOT CONF LONG TEE ECHO SED WILDCARDS LISTEN CP DEBUG WHICH PWD SEQ RMDIR BIG PEDANTIC MKE2FS EXTENDED JOURNAL LABEL FALSE FREE COUNT TOYBOX SHA1SUM TRUE TOUCH DF CAT CHVT HELP SORT READLINK DMESG HELLO NETCAT YES SYNC MDEV CATV PROCARGS ENVVARS PROFILE

The Linux Kernel has 6-12K features, depending how you count! But maximum depth is 8, most leaves are at 4! ↓ this is the Linux kernel model fit to the slide width ↓

c Andrzej W ˛ asowski, IT University of Copenhagen 28

Berger, She, Lotufo, W ˛ asowski, Czarnecki. A Study of Variability Models and Languages in the Systems Software Domain. IEEE Transactions in Software Engineering, 2013

slide-29
SLIDE 29

Is FODA special? Not really!

eCos configurator

◮ Linux kernel and eCos operating system use similar configurator,

controlled by textual variability models

◮ Trees become unwieldy very fast ◮ Many tools used linearized trees, like above ◮ Nice trees are good for PowerPoint, whiteboard and brainstorming

c Andrzej W ˛ asowski, IT University of Copenhagen 29

slide-30
SLIDE 30

It is easy to design a textual syntax

Kconfig of Linux kernel, designed by non-experts, with no tools CDL of eCos, designed by non-experts, with no tools

c Andrzej W ˛ asowski, IT University of Copenhagen 30

slide-31
SLIDE 31

CVL Architecture for Dummies

The degree of coupling can be controlled by moving the mapping Variability Abstraction Variability Realization Base (model) Feature/Decision Models Feature Mapping Source Code

c Andrzej W ˛ asowski, IT University of Copenhagen 31

CVL submitters. Common Variability Language, OMG Revised Submission. 2012

slide-32
SLIDE 32

CVL Architecture for Linux Junkies

Variability Abstraction Variability Realization Base (model) KConfig files KBuild files + CPP C-code

c Andrzej W ˛ asowski, IT University of Copenhagen 32

slide-33
SLIDE 33

Grid View in Pure•Variants

◮ Commercial tools support multiple views of the same model ◮ Some vendors: Pure Systems (DE), Big Lever (US), most PLM tools ◮ Clafer also has the grid view

c Andrzej W ˛ asowski, IT University of Copenhagen 33

slide-34
SLIDE 34

Are all variability models trees?

A Fire Alarm System

◮ detection zones ◮ alarm zones ◮ wiring ◮ three different

structures

◮ Modeled as

constrained class diagrams!

◮ Sometimes called

topological variability

  • Berger. Stanciulescu. Øgård. Haugen. Larsen. W ˛
  • asowski. To connect or not to connect: experiences

from modeling topological variability. SPLC 2014

  • Fantechi. Topologically configurable systems as product families. SPLC 2013

c Andrzej W ˛ asowski, IT University of Copenhagen 34

slide-35
SLIDE 35

Modeled using class diagrams in Papyrus

A model view showing two model hierarchies

PowerLoopDriver AL_ComInterface ExternalComs IO_Module OperationPanel AutroFieldBus OperationZone Domain Group AutroSafePanel AFB_PowerControl Installation AFB_Unit

AlarmZone DetectionZone

[1] [*] [1] [*] [1] [*] [1] [1] [1] [1..*] [1] [1] [1] [1..32] [1] [*] [1] [1..*] [1] [0..7] [1] [1..32]

physical structure logical structure

A home grown configurator used to instantiate mod- els

c Andrzej W ˛ asowski, IT University of Copenhagen 35

slide-36
SLIDE 36

AGENDA

◮ SPL Method, Architecture ◮ Variability Implementation Spectrum ◮ Variability Abstraction: Feature Modeling ◮ Variability Modeling in Practice ◮ Variability Realization

c Andrzej W ˛ asowski, IT University of Copenhagen 36

slide-37
SLIDE 37

Connect Abstraction to Realization

Most of the school is about it :)

variability realization variability abstraction build system

# # CPUFreq processor drivers # CONFIG_X86_PCC_CPUFREQ=m CONFIG_X86_ACPI_CPUFREQ=y CONFIG_X86_POWERNOW_K6=y CONFIG_X86_POWERNOW_K7=y CONFIG_X86_POWERNOW_K7_ACPI=y CONFIG_X86_POWERNOW_K8=y CONFIG_X86_GX_SUSPMOD=y CONFIG_X86_SPEEDSTEP_CENTRINO=y CONFIG_X86_SPEEDSTEP_CENTRINO_TABLE=y CONFIG_X86_SPEEDSTEP_ICH=y CONFIG_X86_SPEEDSTEP_SMI=y CONFIG_X86_P4_CLOCKMOD=m CONFIG_X86_CPUFREQ_NFORCE2=y CONFIG_X86_LONGRUN=y CONFIG_X86_LONGHAUL=y CONFIG_X86_E_POWERSAVER=m

variability resolution

conforms configured against core assets platform product specific assets

c Andrzej W ˛ asowski, IT University of Copenhagen 37

slide-38
SLIDE 38

Feature Models vs DSLs

◮ Feature models are ready and simple (no design effort, deep insight) ◮ DSL requires design effort, but rewards with more expressiveness ◮ Effort also translates to maintenance ◮ FM effort is offset by existing feature modeling tools ◮ DSL development effort is offset by language workbenches Feature Model

# # CPUFreq processor drivers # CONFIG_X86_PCC_CPUFREQ=m CONFIG_X86_ACPI_CPUFREQ=y CONFIG_X86_POWERNOW_K6=y CONFIG_X86_POWERNOW_K7=y CONFIG_X86_POWERNOW_K7_ACPI=y CONFIG_X86_POWERNOW_K8=y CONFIG_X86_GX_SUSPMOD=y CONFIG_X86_SPEEDSTEP_CENTRINO=y CONFIG_X86_SPEEDSTEP_CENTRINO_TABLE=y CONFIG_X86_SPEEDSTEP_ICH=y CONFIG_X86_SPEEDSTEP_SMI=y CONFIG_X86_P4_CLOCKMOD=m CONFIG_X86_CPUFREQ_NFORCE2=y CONFIG_X86_LONGRUN=y CONFIG_X86_LONGHAUL=y CONFIG_X86_E_POWERSAVER=m

Configuration DSL Meta- Model DSL Model

Debug Level :int Compress Data Journalling Flash File System
  • Misc. Filesystems
Support ZLIB Default Compression None Size Priority

conforms to conforms to

c Andrzej W ˛ asowski, IT University of Copenhagen 38

slide-39
SLIDE 39

Advice on Realization

[Stahl and Völter]

◮ Choose functional domain concepts as features / DSL concepts ◮ Start a small domain model and grow it iteratively ◮ Keep the build automatic at all times ◮ Generate/synthesize legible code/models ◮ We follow these principles in the Clafer tutorial on railway stations

c Andrzej W ˛ asowski, IT University of Copenhagen 39

slide-40
SLIDE 40

c Andrzej W ˛ asowski, IT University of Copenhagen 40

slide-41
SLIDE 41

c Andrzej W ˛ asowski, IT University of Copenhagen 41

slide-42
SLIDE 42

AGENDA

◮ SPL Method, Architecture ◮ Variability Implementation Spectrum ◮ Variability Abstraction: Feature Modeling ◮ Variability Modeling in Practice ◮ Variability Realization

c Andrzej W ˛ asowski, IT University of Copenhagen 42