software product lines - carnegie mellon school of computer … · software product lines “a...
TRANSCRIPT
![Page 1: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/1.jpg)
Software Product Lines
15-214
Charlie Garrod, Christian Kästner
1
![Page 2: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/2.jpg)
![Page 3: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/3.jpg)
toad 315-214 Kaestner
Reuse and Variations
![Page 4: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/4.jpg)
toad 415-214 Kaestner
![Page 5: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/5.jpg)
toad 515-214 Kaestner
![Page 6: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/6.jpg)
toad 615-214 Kaestner
![Page 7: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/7.jpg)
Reuse and Variation
![Page 8: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/8.jpg)
Configuration in Software
• Systems cover all possible functionality– e.g., Windows, Open Office, Oracle, SAP myERP,
Photoshop
• Specialized software and software for embedded systems increasingly important– Mobile divices, sensor networks, automotive systems,
consumer electronics, smart cards, ubiquitious computing
– 98% of all CPUs in embedded devices [2000]
– Resource constraints, heterogeneous hardware
8
![Page 9: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/9.jpg)
Database Systems
• Increasing data volumes
• Resource constraints inembedded environments
9
![Page 10: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/10.jpg)
DatabaseEngine
![Page 11: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/11.jpg)
Printer Firmware
![Page 12: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/12.jpg)
LinuxKernel
![Page 13: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/13.jpg)
Linux kernel
~6 000 000 Lines of C code Highly configurable
> 10.000 configuration options! (x86, 64bit, …)
Most source code is “optional”
![Page 14: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/14.jpg)
15
![Page 15: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/15.jpg)
![Page 16: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/16.jpg)
![Page 17: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/17.jpg)
Software Product Linesin Industry
BoeingBosch GroupCummins, Inc.EricssonGeneral DynamicsGeneral MotorsHewlett PackardLockheed MartinLucentNASANokiaPhilipsSiemens…
![Page 18: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/18.jpg)
CHALLENGES
19
![Page 19: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/19.jpg)
a unique configuration for every
person on this planet
33 featuresoptional, independent
![Page 20: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/20.jpg)
320 features
more configurations than estimated
atoms in the universe
optional, independent
![Page 21: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/21.jpg)
2000 Features 10000Features
![Page 22: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/22.jpg)
199 Configuration parameters
for the optimizer
(1600 total)
![Page 23: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/23.jpg)
Correctness?Correctness?
![Page 24: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/24.jpg)
Understanding?Understanding?
![Page 25: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/25.jpg)
Software Product Lines
“A software product line is a set of software-intensive systems that share a common, managed set of features satisfying the specific needs of a particular market segment or mission and that are developed from a common set of core assets in a prescribed way.”
SEI
![Page 26: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/26.jpg)
The Promise
# Products
CostsDevelopment
without reuse
Developmentwith reuse
![Page 27: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/27.jpg)
CONQUERING VARIABILITY
28
![Page 28: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/28.jpg)
![Page 29: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/29.jpg)
Domain Analysis
(feature modeling)Dom
ain
En
gin e
eri n
gA
ppl
i cat
ion
Eng
inee
ri ng
Domain Implementation
(models, source code)
Requirements Analysis
(feature selection)
Application Derivation
(generator, testing)
Domainknowledge
Customerneeds Product
![Page 30: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/30.jpg)
![Page 31: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/31.jpg)
![Page 32: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/32.jpg)
![Page 33: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/33.jpg)
Domain Analysis
(feature modeling)Dom
ain
En
gin e
eri n
gA
ppl
i cat
ion
Eng
inee
ri ng
Domain Implementation
(models, source code)
Requirements Analysis
(feature selection)
Application Derivation
(generator, testing)
Domainknowledge
Customerneeds Product
![Page 34: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/34.jpg)
IMPLEMENTATION
35
![Page 35: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/35.jpg)
Domain Analysis
(feature modeling)Dom
ain
En
gin e
eri n
gA
ppl
i cat
ion
Eng
inee
ri ng
Domain Implementation
(models, source code)
Requirements Analysis
(feature selection)
Application Derivation
(generator, testing)
Domainknowledge
Customerneeds Product
![Page 36: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/36.jpg)
Runtime Parameters
Parameters, variables, constants
![Page 37: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/37.jpg)
Parameter
38
![Page 38: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/38.jpg)
Parameter –i in grep
39
![Page 39: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/39.jpg)
Global configuration optionsclass Config { public static boolean isLogging = false; public static boolean isWindows = false; public static boolean isLinux = true;}class Main { public void foo() { if (isLogging) log(“running foo()“); if (isWindows) callWindowsMethod(); else if (isLinux) callLinuxMethod(); else throw RuntimeException();} 40
![Page 40: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/40.jpg)
Propagating Parameters
41
durch viele Aufrufepropagiert statt globaler Variable
![Page 41: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/41.jpg)
Selecting configurations
42
• Command line parameters
• Config file
• User dialog
• Source code
• …
![Page 42: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/42.jpg)
Graph Library
class Edge { Node a, b; Color color = new Color(); Weight weight; Edge(Node _a, Node _b) { a = _a; b = _b; } void print() { if (Conf. COLORED) Color.setDisplayColor(color); a.print(); b.print(); if (!Conf.WEIGHTED) weight.print(); }}
class Graph { Vector nv = new Vector(); Vector ev = new Vector(); Edge add(Node n, Node m) { Edge e = new Edge(n, m); nv.add(n); nv.add(m); ev.add(e); if (Conf.WEIGHTED) e.weight = new Weight(); return e; } Edge add(Node n, Node m, Weight w) if (!Conf.WEIGHTED) throw RuntimeException(); Edge e = new Edge(n, m); nv.add(n); nv.add(m); ev.add(e); e.weight = w; return e; } void print() { for(int i = 0; i < ev.size(); i++) { ((Edge)ev.get(i)).print(); } }}
class Node { int id = 0; Color color = new Color(); void print() { if (Conf.COLORED) Color.setDisplayColor(color); System.out.print(id); }}
class Color { static void setDisplayColor(Color c) { ... } } class Weight { void print() { ... } }
class Conf { public static boolean COLORED = true; public static boolean WEIGHTED = false;}
![Page 43: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/43.jpg)
199 Configuration parameters
for the optimizer
(1600 total)
![Page 44: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/44.jpg)
Limitations
45
• Variable code scattered in entire program
– Hard to test in isolation
• Global variables or long parameter lists
• All code always included
– Binary size, memory consumption
– Performance
– Unused functionality as attack vector
• Changes at runtime or load-time?
![Page 45: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/45.jpg)
Limitations
46
• Variable code scattered in entire program
– Hard to test in isolation
• Global variables or long parameter lists
• All code always included
– Binary size, memory consumption
– Performance
– Unused functionality as attack vector
• Changes at runtime or load-time?
compile-time if
designpattern
![Page 46: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/46.jpg)
Preprocessors
conditional compilation
#ifdef
![Page 47: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/47.jpg)
![Page 48: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/48.jpg)
Berkeley DB
#include "db_int.h"
static int __rep_queue_filedone(dbenv, rep, rfp)DB_ENV *dbenv;REP *rep;__rep_fileinfo_args *rfp; {
#ifndef HAVE_QUEUECOMPQUIET(rep, NULL);COMPQUIET(rfp, NULL);return (__db_no_queue_am(dbenv));
#elsedb_pgno_t first, last;u_int32_t flags;int empty, ret, t_ret;
#ifdef DIAGNOSTICDB_MSGBUF mb;
#endif// over 100 lines of additional code
}#endif
49
![Page 49: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/49.jpg)
Preprocessor in Java?• No native preprocessor• Some compilers support conditional
compilation at statement level
• External tools
class Example {public static final boolean DEBUG = false;
void main() {System.out.println(“immer”);if (DEBUG) {
System.out.println(“debug info”); printDetails(); }
} void printDetails() { ... }}
50
![Page 50: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/50.jpg)
Munge• Simple external preprocessor for Java• Originally developed for Swing 1.2
class Example {void main() {
System.out.println(“immer”);/*if[DEBUG]*/System.out.println(“debug info”);/*end[DEBUG]*/
}}
java Munge –DDEBUG –DFEATURE2 file1.java file2.java
http://weblogs.java.net/blog/tball/archive/2006/09/munge_swings_se.html51
![Page 51: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/51.jpg)
Configurable Graph Libraryclass Edge { Node a, b; /*if[COLOR]*/ Color color = new Color(); /*end[COLOR]*/ /*if[WEIGHT]*/ Weight weight; /*end[WEIGHT]*/ Edge(Node _a, Node _b) { a = _a; b = _b; } void print() { /*if[COLOR]*/ Color.setDisplayColor(color); /*end[COLOR]*/ a.print(); b.print(); /*if[WEIGHT]*/ weight.print(); /*end[WEIGHT]*/ }}
class Graph { Vector nv = new Vector(); Vector ev = new Vector(); Edge add(Node n, Node m) { Edge e = new Edge(n, m); nv.add(n); nv.add(m); ev.add(e); /*if[WEIGHT]*/ e.weight = new Weight(); /*end[WEIGHT]*/ return e; } /*if[WEIGHT]*/ Edge add(Node n, Node m, Weight w) Edge e = new Edge(n, m); nv.add(n); nv.add(m); ev.add(e); e.weight = w; return e; } /*end[WEIGHT]*/ void print() { for(int i = 0; i < ev.size(); i++) { ((Edge)ev.get(i)).print(); } }}
class Node { int id = 0; /*if[COLOR]*/ Color color = new Color(); /*end[COLOR]*/ void print() { /*if[COLOR]*/ Color.setDisplayColor(color); /*end[COLOR]*/ System.out.print(id); }}
/*if[COLOR]*/class Color { static void setDisplayColor(Color c) { ... } }/*end[COLOR]*/
/*if[WEIGHT]*/class Weight { void print() { ... } } /*end[WEIGHT]*/
![Page 52: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/52.jpg)
2000 Features 10000Features
![Page 53: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/53.jpg)
Discussion• Compile-time configuration
• Can remove arbitrary code before compilation
• Simple programming model
• Bad reputation– Scattered code
– Error prone
– Hard to understand
– Invites neglecting design
– Hinder tool support
54
![Page 54: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/54.jpg)
class Stack {void push(Object o
#ifdef SYNC, Transaction txn
#endif) {
if (o==null#ifdef SYNC
|| txn==null#endif
) return;#ifdef SYNC
Lock l=txn.lock(o);#endif
elementData[size++] = o;#ifdef SYNC
l.unlock();#endif
fireStackChanged();}
}
class Stack {void push(Object o
#ifdef SYNC, Transaction txn
#endif) {
if (o==null#ifdef SYNC
|| txn==null#endif
) return;#ifdef SYNC
Lock l=txn.lock(o);#endif
elementData[size++] = o;#ifdef SYNC
l.unlock();#endif
fireStackChanged();}
}
![Page 55: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/55.jpg)
Femto OS
56
![Page 56: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/56.jpg)
![Page 57: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/57.jpg)
![Page 58: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/58.jpg)
Error Prone
static int _rep_queue_filedone(...)DB_ENV *dbenv;REP *rep;__rep_fileinfo_args *rfp; {
#ifndef HAVE_QUEUECOMPQUIET(rep, NULL);COMPQUIET(rfp, NULL);return (__db_no_queue_am(dbenv));
#elsedb_pgno_t first, last;u_int32_t flags;int empty, ret, t_ret;
#ifdef DIAGNOSTICDB_MSGBUF mb;
#endif//over 100 lines of additional code
}#endif
#ifdef TABLESclass Table { void insert(Object data,
Txn txn) { storage.set(data,
txn.getLock()); }}#endifclass Storage {#ifdef WRITE boolean set(…) { ... }#endif}
![Page 59: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/59.jpg)
Error Prone
static int _rep_queue_filedone(...)DB_ENV *dbenv;REP *rep;__rep_fileinfo_args *rfp; {
#ifndef HAVE_QUEUECOMPQUIET(rep, NULL);COMPQUIET(rfp, NULL);return (__db_no_queue_am(dbenv));
#elsedb_pgno_t first, last;u_int32_t flags;int empty, ret, t_ret;
#ifdef DIAGNOSTICDB_MSGBUF mb;
#endif//over 100 lines of additional code
}#endif
#ifdef TABLESclass Table { void insert(Object data,
Txn txn) { storage.set(data,
txn.getLock()); }}#endifclass Storage {#ifdef WRITE boolean set(…) { ... }#endif}
![Page 60: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/60.jpg)
A matter of scale
E x a m p l e : S e s s i o n e x p i r a t i o n i n t h e A p a c h e T o m c a t S e r v e r
61
![Page 61: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/61.jpg)
Design Pattern and Frameworks
best practice
separation
![Page 62: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/62.jpg)
Strategy Pattern
63
![Page 63: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/63.jpg)
Template Method Pattern
64
![Page 64: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/64.jpg)
Inheritance for Variability
65
S t a c k
S e c u r e S t a c k S y n c h r o n i z e d S t a c kU n d o S t a c k
modular, but inflexible
![Page 65: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/65.jpg)
Inflexible Extension Mechanism
S t a c k
S e c u r e S t a c k
S y n c h r o n i z e d S t a c k
U n d o S t a c k
S t a c k
S e c u r e S t a c k S y n c h r o n i z e d S t a c kU n d o S t a c k
Extensions
not combinable
Middle extension
not optional
cf. White-Box Framework
![Page 66: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/66.jpg)
Work arounds?
• Combining inheritance hierarchies– Combinatorical explosion– Massive code replication
• Multiple inheritance– Diamond problem
S t a c k
S e c u r e S t a c k
S y n c h r o n i z e d U n d o S e c u r e S t a c k
U n d o S t a c k
U n d o S e c u r e S t a c kS y n c h r o n i z e d U n d o S t a c k
S y n c h r o n i z e d S t a c k
+ p u s h ( )+ p o p ( )+ s i z e ( )
- v a l u e s
S t a c k
+ p u s h ( )+ p o p ( )+ s i z e ( )+ l o c k ( )+ u n l o c k ( )
L o c k e d S t a c k
+ p u s h ( )+ p o p ( )+ u n d o ( )
- l o g
U n d o S t a c k
L o c k e d U n d o S t a c k
![Page 67: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/67.jpg)
Decorator Pattern
+ p u s h ( )+ p o p ( )+ s i z e ( )
« i n t e r f a c e »I S t a c k
+ p u s h ( )+ p o p ( )+ s i z e ( )
- v a l u e s
S t a c k
+ p u s h ( )+ p o p ( )+ s i z e ( )
- d e l e g a t e
S t a c k D e c o r a t o r
+ p u s h ( )+ p o p ( )+ s i z e ( )+ l o c k ( )+ u n l o c k ( )
L o c k e d S t a c k
+ p u s h ( )+ p o p ( )+ u n d o ( )
- l o g
U n d o S t a c k
+ p u s h ( )+ p o p ( )+ e n c r y p t( )+ d e c r y p t( )
- k e y p h r a s e
S e c u r e S t a c k
1
1
![Page 68: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/68.jpg)
Frameworks
• Set of abstract and concrete classes• Reusable solutions of a set of problems• Planned hot spots, extended by plug-ins
• Extension mechanisms often based on design patterns
– Strategy
– Template method
– Observer
69
![Page 69: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/69.jpg)
Discussion
• Separated, modular extensions
– Compile and test plug-ins separately• Compile-time/load-time configuration• Well understood in practice• Hard to design, hard to evolve• Small runtime overhead• Suited for coarse-grained extensions
70
![Page 70: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/70.jpg)
ANALYSIS
71
![Page 71: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/71.jpg)
![Page 72: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/72.jpg)
320 features
more configurations than estimated
atoms in the universe
optional, independent
![Page 73: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/73.jpg)
From HP to Linux
2000 FeaturesInhouse configuration100 Printers (Product Map)30 New Printers per Year
10000 FeaturesEnd user configures
210000 Configurations
∀ p PL . ...∈
![Page 74: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/74.jpg)
true
Dead-Code Detection
line 1#ifdef Aline 2 #ifndef A line 3 #endifline 4#elif defined(X)line 5#elseline 6#endif
A
A ^ not A
A
not A ^ X
not A ^ not X
Dead code
Analysis:SAT(pc(block i))
![Page 75: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/75.jpg)
Variability Models
76
![Page 76: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/76.jpg)
4/13/2011
![Page 77: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/77.jpg)
![Page 78: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/78.jpg)
Cohen et al. Interaction testing of highly-configurable systems in the presence of constraints. ISSTA 2007
F1 F2 F3
on on on
on on off
on off on
on off off
off on on
off on off
off off on
off off off
Pairwise Testing
![Page 79: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/79.jpg)
Cohen et al. Interaction testing of highly-configurable systems in the presence of constraints. ISSTA 2007
F1 F2 F3
on on on
on on off
on off on
on off off
off on on
off on off
off off on
off off off
Pairwise Testing
![Page 80: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/80.jpg)
Closed-World Analysis
Specified Variability Implementation Variability
P
WORLD BYE
WORLD v BYE
¬ (WORLD ˄ BYE)
(WORLD v BYE) ˄¬ (WORLD ˄ BYE)
Check Consistency
∀ p PL .∈ p is well-typed
![Page 81: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/81.jpg)
Other Topics
• Product planning, product-line scoping
• Team organization
• Development and design process (domain engineering)
• More implementation techniques (components, version control systems, feature/aspect-oriented development)
• Product-line analysis
![Page 82: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/82.jpg)
![Page 83: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/83.jpg)
Further Reading
S. Apel, D. Batory, C. Kästner, and G. Saake. Feature-Oriented Software Product Lines: Concepts and Implementation. Berlin/Heidelberg: Springer-Verlag, 2013.
K. Czarnecki and U. Eisenecker. Generative Programming: Methods, Tools, and Applications. Addison-Wesley, 2000.
P. Clements, L. Northrop. Software Product Lines: Practices and Patterns. Addison-Wesley, 2002
84
![Page 84: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/84.jpg)
15-313: Foundations of Software Engineering
• Advanced Topics– From Design Pattern to Architectures
– Dynamic and Static Analysis
– Inspection, Advanced Testing
– Git, Continuous Integration
• Human Aspects in Software Engineering– Teams
– Process
– Requirements
– Economics, Risks
– Empirical Results
• Concurrency and Security as Themes
![Page 85: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/85.jpg)
Summer Project: Analyzing Github
• Setup Analysis Infrastructure
• Metrics for Active Developers
• Speculative Unit Test Execution
• Unix, Databases +
![Page 86: Software Product Lines - Carnegie Mellon School of Computer … · Software Product Lines “A software product line is a set of software-intensive systems that share a common, managed](https://reader030.vdocuments.site/reader030/viewer/2022020305/5c66a28e09d3f20f218c93bd/html5/thumbnails/86.jpg)
Summary
• Software product lines: Systematic reuse by planning variations
• From runtime parameters and conditional compilation to design patterns and frameworks
• Analysis for product lines
87