Software Product Line Engineering With ABS
Software Product Line Engineering With ABS
Radu Muschevici
1 / 54
Software Engineering Challenges
2 / 54
Software Engineering Challenges
Traditional Solutions
“Traditional” methods
▶ Build individual software product from scratch for each customer.
▶ Too inefficient, costly
3 / 54
Software Engineering Challenges: SPLE
Software Product Lines (SPL), a.k.a. Software Product Families
Development Effort
▶ Develop collection of similar software products from a shared set
of software assets.
Effort/Costs
Traditional
Development
Software
Product
Lines
# Variants
1 2 3 4
37
5 / 54
Software Variability
6 / 54
Features
7 / 54
The SPLE Process
8 / 54
The SPLE Process
Diagram
1. Domain Engineering
2. Application Engineering
Software Product
9 / 54
The SPLE Process
Diagram
Software Product
10 / 54
The SPLE Process using ABS
Diagram
Feature Selection
2. Application Engineering
(Product)
Software Product
11 / 54
The SPLE Process: Problem Space
Feature Selection
2. Application Engineering
(Product)
Software Product
1. Features
2. Feature Models
3. Feature Selection
4. µTVL: The feature modelling language of ABS
12 / 54
What is a Feature in SPLE?
13 / 54
Feature Modelling
Feature Model
▶ Models the variability of an SPL.
▶ Describes relationships between features
⇒ which feature combinations (selections) are valid?
▶ Model elements: features and their relationships (constraints).
14 / 54
Feature Selection
15 / 54
Feature Model Example
16 / 54
Feature Selection Example
17 / 54
Feature Diagrams
18 / 54
Feature Diagrams (cont.)
▶ Tree structure
▶ Nodes represent features (optional feature denoted by circle)
▶ Edges represent standard constraints, such as choice
(one-out-of-many, some-out-of-many, all-out-of-many)
▶ More general constraints (“cross-tree” constraints) need to be
specified with additional propositional logic formulas,
E.g. Video ⇒ (Voice ∧ Text)
19 / 54
Feature Diagram Semantics: Propositional Formula
20 / 54
sjunctive combinations. notations for disjunctive combinations.
In Fig.and
he edges between a parent feature 2.3,athe edges
group between
of child a parent
features feature and a group of child features fi are
fi are
Feature Diagram Semantics (cont.)
connected
n empty arc. This graphical elementvia
featureone
outfrom
an empty
denotes
of a {feature
arc. This
a choice graphical
of exactly one element denotes a choice of exactly one
(that is, choose one from {f1 . . . fn }). In propositional
feature group (that is, choose f1 . . . fgroup
n }). In propositional
logic,
eralization of an exclusive it is a generalization
disjunction. Typical examples of an of
exclusive
exclusivedisjunction. Typical examples of exclusive
disjunctions of of
features are different implementations features
the same are functionality
different implementations
or of the same functionality or
Mandatory Optional
al notation 2.3Fig.Feature Modeling
2.2 Graphical notation 29
manda- for optional and manda-
lled bullet tory features. A filled bullet
Fig. 2.3 Graphical notation
ry feature, denotes a mandatory feature,
et denotes
forand
a one-out-of many
an empty bullet choice.
denotes
This choicefeature
an optional corresponds to a
generalized xor operator
f⇔p f⇒p
29
Choice: one-out-of-many Choice: some-out-of-many
Fig. 2.4 Graphical notation
for a some-out-of-many
choice. This choice corre-
sponds to the logical or
operator
∧
((f1 ∨ . . . ∨ fn ) ⇔ p) ∧ ¬(fi ∧ fj ) (f1 ∨ . . . ∨ fn ) ⇔ p
i<j
different technical platforms such as the choice of the supported operating system.
This construct is called alternative or mutually exclusive choice.
Figure 2.4 shows child features connected via a filled arc. This graphical element 21 / 54
Feature Modelling in ABS
22 / 54
Feature Model Example1
Feature Diagram for an SPL of Bank Accounts
Account
excludes
Checking Savings
0≤interest≤1 interest>1
1
[Hähnle 2013]
23 / 54
Feature Model Example: ABS Implementation
24 / 54
define additional constraints,
Specific if the
graphical child features
elements define of a
additional constraints, if the child features of a
Feature Diagrams to ABS-µTVL
cted independently.
common Figures
parent2.3 and 2.4
cannot show graphical
be selected
inations. notations for disjunctive combinations.
independently. Figures 2.3 and 2.4 show graphical
ABS: ABS:
p group allof { f } p group allof { opt f }
25 / 54
Feature Diagrams to ABS-µTVL (2)
g 29
Choice: one-out-of-many
otation
y choice.
nds to a
ator
otation
anyABS:
corre-p group oneof { f1, f2, ..., fn }
l or
26 / 54
Feature Diagrams to ABS-µTVL (3)
Choice: some-out-of-many
otation
ny
orre-
or
ABS:
platforms such as the choice of the supported operating system.
p group [1..*] { f1, f2, ..., fn }
alled alternative or mutually exclusive choice.
s child features connected via a filled arc. This graphical element 2 – a more
ABS-
cted µTVL
choice of onesupports cardinality-based
or more features out of a feature feature
group. It modelling
is
oneflexible notation
feature of to express
the collection choice.
has to be selected,Example: zero-to-two-out-of-n:
but there are no
Mathematically, it denotes an inclusive
p group [0..2] { f1, f2, ..., fn } disjunction.
cting one
2 or several supported data types for storage is an example
[Czarnecki, Helsen, and Eisenecker 2004]
choice in the domain of embedded data management. For the 27 / 54
Feature Model Semantics
28 / 54
Products
// Checking Accounts
product Basic (Type{interest=0}, Checking, Overdraft, Fee{amount=1});
// Savings Accounts
product BasicSaver (Type{interest=2}, Savings);
29 / 54
Product Expressions
Example:
product Basic (Type{interest=0}, Checking, Overdraft, Fee{amount=1});
product Student = Basic - {Overdraft, Fee};
▶ More concise
▶ Establish dependencies between products
3
[Triando 2015]
30 / 54
The SPLE Process: Solution Space
Feature Selection
2. Application Engineering
(Product)
Software Product
31 / 54
Delta-Oriented Programming
4
[Schaefer et al. 2010]
32 / 54
Delta Modules (Deltas)
ABS deltas are code modules. They can add, remove or modify…
▶ Classes
▶ Interfaces
▶ Functions
▶ Algebraic Data Types
▶ Type synonyms
▶ Module imports & exports
33 / 54
Code Reuse with Deltas
ABS has
▶ No subclassing, only subtyping (no extends, only implements)
▶ No traits, mixins, aspects, context layers, …
Instead: Deltas
34 / 54
Application of Deltas
apply deltas
35 / 54
Example: Core of Accounts SPL
module Account;
interface Account {
Int deposit(Int x);
}
36 / 54
Example: Deltas of Accounts SPL
37 / 54
Accessing “Previous” Behaviour
As in previous example:
delta DFee (Int fee); // Implements feature Fee
uses Account;
modifies class AccountImpl {
modifies Int deposit(Int x) {
Int result = x;
if (x >= fee)
result = original(x-fee); // call previous version of deposit method
else
result = original(x); // call previous version of deposit method
return result;
}
}
38 / 54
Mapping Features to Deltas
Problem space: Feature model Solution space: Core + Deltas
Modules
Feature Core
Model Deltas
SPL Configuration
39 / 54
Mapping Features to Deltas
SPL Configuration Example
productline Accounts;
features Type, Fee, Overdraft, Check, Save;
Application conditions…
▶ Associate deltas with features.
▶ Are boolean formulas over features and feature attributes:
▶ when formula evaluates to true, given delta is applied.
▶ Enable flexible mapping of feature to deltas: 1:1, 1:n, n:1, n:m
Examples:
productline ExampleSPL;
features A, B, C, F;
41 / 54
Delta Application Order
The order in which deltas are applied is important; deltas applied later
in the sequence may depend on elements that have been added (or
removed) earlier. Example:
delta D1;
modifies class C {
removes Unit foo(); // remove method foo from class C
}
delta D2;
modifies class C {
adds Int x=0;
adds Int foo() { ... return x; } // re−add method foo in class C
}
42 / 54
Automated Product Derivation
43 / 54
Automated Product Derivation Example
P1
P2
FS, DS
P3
core
..
.
Pn
44 / 54
DOP in Practice: Resolving Feature Interactions
LinkedList
ForwardLink BackwardLink
46 / 54
Feature Interaction Example
47 / 54
Feature Interaction Example (2)
Corrected behaviour:
class MyList {
Node first; Node last;
Unit insertAtEnd(Node n) {
if (first == null) last = n; else first.prev = n;
n.next = first; first = n;
}
Unit insertAtBeginning(Node n) {
if (last == null) first = n; else last.next = n;
n.prev = last; last = n;
}
}
class Node {
Node prev; Node next;
}
48 / 54
Feature Interaction Example (3)
productline ListPL;
features ForwardLink, BackLink;
delta DForwardLink when ForwardLink;
delta DBackLink when BackLink;
delta DDoubleLink after DForwardLink, DBackLink when ForwardLink && BackLink;
49 / 54
Feature Interaction Example (4)
50 / 54
Developing Product Lines with
Summary: SPLE with ABS
Feature Modules
1:1 Mapping
[1,n]:[1,n] Mapping
Features to Feature
Features to DeltaModules
Modules Core
Feature Modules
Feature Model Delta1
Delta2
Delta Modules
Delta3
Delta...
Feature Selection
As Input
Variant
Feature Selection Composition Mechanism
61
51 / 54
Summary: Delta-Oriented Programming
52 / 54
References I
Apel, Sven, Don Batory, Christian Kästner, and Gunter Saake (2013).
Feature-Oriented Software Product Lines: Concepts and
Implementation. Springer.
Czarnecki, Krzysztof, Simon Helsen, and Ulrich Eisenecker (2004).
“Staged Configuration Using Feature Models”. In: Software Product
Lines. Springer, pp. 162–164.
Hähnle, Reiner (2013). “The Abstract Behavioral Specification
Language: A Tutorial Introduction”. In: Formal Methods for
Components and Objects. Vol. 7866. LNCS. Springer, pp. 1–37.
Krueger, Charles W. (2002). “Easing the Transition to Software Mass
Customization”. In: Software Product-Family Engineering.
Vol. 2290. LNCS. Springer, pp. 282–293.
53 / 54
References II
Schaefer, Ina, Lorenzo Bettini, Ferruccio Damiani, and Nico Tanzarella
(2010). “Delta-oriented programming of software product lines”. In:
International Software Product Line Conference. SPLC ’10.
Springer, pp. 77–91.
Triando (2015). “Extending the Product Selection Language of ABS
with Product Expressions”. B.Sc. Thesis. Universitas Indonesia.
54 / 54