• Keine Ergebnisse gefunden

Software Product Line Engineering Version Control and Build Systems

N/A
N/A
Protected

Academic year: 2022

Aktie "Software Product Line Engineering Version Control and Build Systems"

Copied!
27
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Software Product Line Engineering

Version Control and Build Systems

Christian Kästner (Carnegie Mellon University) Sven Apel (Universität Passau) Norbert Siegmund (Bauhaus-Universität Weimar) Gunter Saake (Universität Magdeburg)

(2)

Domain Eng.Application Eng.

Feature Selection

Feature Model Reusable Implementation

artifacts

Generator Resulting Program

2

How to implement variability?

(3)

Recap: Variability at Runtime

Parameter

Global configuration vs. propagating parameters

Design Patterns

Observer (Observer and Subject)

Template Method (inheritance)

Strategy Pattern (Context + Interface for alternative algorithms)

Decorator Pattern (Delegation + Interface)

(4)

Variability at Compile Time

Goal: Only actually required source code gets compiled

Small, optimized variants

Source code gets selected and composed

How to implemented optional and alternative code?

Here: simple methods for few variants

4

(5)

Version Control Systems

(6)

Version Control System

Part of the configuration management

Versioning of source-code files

Shared development

Archive of old code versions

Time stamp and user id

Changes as deltas

Process: Checkout – Change – Commit – Update – Change – Commit - …

Examples: CVS, SVN, Visual SourceSafe, Perforce, SCCS, Git, Mercurial

6

(7)

Branching & Merging

Master

Variant A

Variant B

(8)

Parallel Development

(9)

Fixes, Variants, Releases

Master

Hotfix

Release

Develop

Variants

(10)

Variants of Graph Library

Basis variant

(with weights and colors) Variant 2 without weights

Variant 3 without weights and without colors

10

(11)

Scaling?

(12)

Code and Non-Code Files

12

Java Code

Documentation

Models

Build scripts: Ant/Makefile/Maven/Graddle

Licenses

Grammars

Compiled files (be careful! Usually not advised)

HTML, JavaScript, CSS

For binary files is conflict resolution and merging problematic

(13)

Variants vs. Revisions

Revisionen

Varianten

(14)

Variants vs. Revisions

V1.0 V1.1 V2.0 V3.0

Sensor-DB (Auto)

SmartCard-DB GPS-DB

Sensor-DB (Habitat Monitoring) Sensor-DB (Erdbeben)

X X X X

X X X

X X

X X X X

X

Revisions

Variants

14

(15)

Development of variants in branches

Merge of changes between branches

Product Lines with Version Control

Domain Eng.tion Eng.

Variant list

Version control with branches

Variant as input

Sensor-DB (Auto)

Sensor-DB (Habitat Monitoring)

•Sensor-DB (Auto)

•Sensor-DB (Habitat Monitoring)

•Sensor-DB (Erdbeben)

•SmartCard-DB

•GPS-DB

Mapping from variant to branch

(16)

Product Line with Version Control – Discussion

Advantages

Established, reliable system

Know process

Excellent workflow and tool integration

Drawbacks

Mixed revisions with variants

Development of variants, not (smaller) features: flexible combination of features is not possible

No systematic reuse mechanism (Copy & Edit)

High maintenance effort (Merging)

16

(17)

Build Systems

(18)

Build-Systeme

Automating the build process

Copies files, integrates libraries, handles dependencies, calls compiler, executes addition tools…

Multiple steps with dependencies and requirements

Tools: GNU make, Ant, Maven, Gradle, …

18

(19)

<?xml version="1.0"?>

<projectname="Ant-Test"default="main"basedir=".">

<!-- Sets variables which can later be used. -->

<!-- The value of a property is accessed via ${} -->

<propertyname="src.dir"location="src"/>

<propertyname="build.dir"location="bin"/>

<propertyname="dist.dir"location="dist"/>

<propertyname="docs.dir"location="docs"/>

<!-- Deletes the existing build, docs and dist directory-->

<target name="clean">

<deletedir="${build.dir}"/>

<deletedir="${docs.dir}"/>

<deletedir="${dist.dir}"/>

</target>

<!-- Creates the build, docs and dist directory-->

<target name="makedir">

<mkdirdir="${build.dir}"/>

<mkdirdir="${docs.dir}"/>

<mkdirdir="${dist.dir}"/>

</target>

<!-- Compiles the java code (including the usage of library for JUnit -->

<target name="compile"depends="clean, makedir">

<javacsrcdir="${src.dir}"destdir="${build.dir}">

(20)

Product Lines with Build Systems

One configuration file / build script for each variant

Compilation process integrates or ignores files

Overwriting files with product-specific variants

20

(21)

Example: Graph Library

Basic Code

Variants with weights

build.xml

build.xml src

Graph.java Edge.java

classEdge { Node a, b;

Edge(Node _a, Node _b) { a = _a; b = _b; } voidprint() {

a.print(); b.print();

} }

classEdge { Node a, b;

(22)

Alternative Example: Graph Library

classEdge { Node a, b;

Edge(Node _a, Node _b) { a = _a; b = _b; } voidprint() {

a.print(); b.print();

} }

classWEdge extends Edge { Weight weight;

voidprint() { super.print();

weight.print();

} }

…and adapt all constructor calls;

use of Factory Pattern could help

Basic code

Variant with weights

build.xml

build.xml src

src

Graph.java Edge.java

WEdge.java

(23)

Product Line with Build System

Domain Eng.Application Eng.

Feature Model

Basic Implementation

Sensor-DB (Auto)

Sensor-DB (Habitat Monitoring)

Sensor-DB (Erdbeben)

SmartCard-DB

GPS-DB

(24)

Product Lines with Build Systems – Discussion

Relatively simple mechanism

High flexibility– arbitrary changes for variants

Little preplanning possible

Development for each variant separated, could lead to high development effort during Application Engineering

Changes at file level (overwriting of whole files)

Changes at base implementation difficult

24

(25)

Outlook

Additional methods for implementing variability at compile time

But: Developing features instead of variants

(26)

Literature

M. Staples, D. Hill. Experiences adopting software product line development without a product line architecture.

Proceedings APSEC, pp. 176—183, 2004

[Industrial experience with version control and build systems for product line development]

T. Dhaliwal, F. Khomh, Y. Zou, A. Hassan. Recovering commit dependencies for selective code integration in software product lines. Proceedings ICSM, 202—211, 2012

[Assignment of commints to features; Dependency analysis]

26

(27)

Quiz

Should we use branches for the development of program variants or for the development of individual features? List pros and cons.

How do version control systems, build systems, and runtime parameters interact?

What is the role of granularity of changes in version control or build systems?

Referenzen

ÄHNLICHE DOKUMENTE

About 80% of all software systems today are software product lines or can at least profit. from product

 Modules can be composed within a new context of another project (variability).. Design Patterns for Variability.. Observer Pattern. “Define[s] a one-to-many dependency

Software Product Line Engineering.. Lab

 Make feature explicit in source

building systems [...] in a particular domain in the form of reusable assets [...], as well as providing an adequate means for reusing these assets (i.e., retrieval, qualification,

 -oriented programming solves the feature traceability problem via collaborations and rolls (mapping). Implementation via

 If the base code changes, existing pointcuts could match to new join points or existing join points will not match anymore.  Chess example: A developer adds a method to declare a

• //every method invocation inside the method Server.broadcast() unless the target is an instance of class Connection pointcut