software product lines
play

Software Product Lines 15-214 Charlie Garrod, Christian Kstner 1 - PowerPoint PPT Presentation

Software Product Lines 15-214 Charlie Garrod, Christian Kstner 1 Reuse and Variations 15-214 Kaestner toad 3 15-214 Kaestner toad 4 15-214 Kaestner toad 5 15-214 Kaestner toad 6 Reuse and Variation Configuration in Software


  1. Software Product Lines 15-214 Charlie Garrod, Christian Kästner 1

  2. Reuse and Variations 15-214 Kaestner toad 3

  3. 15-214 Kaestner toad 4

  4. 15-214 Kaestner toad 5

  5. 15-214 Kaestner toad 6

  6. Reuse and Variation

  7. 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

  8. Database Systems • Increasing data volumes • Resource constraints in embedded environments 9

  9. Database Engine

  10. Printer Firmware

  11. Linux Kernel

  12. Linux kernel  ~6 000 000 Lines of C code  Highly configurable  > 10.000 configuration options! (x86, 64bit, …)  Most source code is “optional”

  13. 15

  14. Software Product Lines in Industry Boeing Bosch Group Cummins, Inc. Ericsson General Dynamics General Motors Hewlett Packard Lockheed Martin Lucent NASA Nokia Philips Siemens …

  15. CHALLENGES 19

  16. 33 features optional, independent a unique configuration for every person on this planet

  17. 320 features optional, independent more configurations than estimated atoms in the universe

  18. 10000 2000 Features Features

  19. 199 Configuration parameters for the optimizer (1600 total)

  20. Correctness? Correctness?

  21. Understanding? Understanding?

  22. 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

  23. The Promise Costs Development without reuse Development with reuse # Products

  24. CONQUERING VARIABILITY 28

  25. g n n i Domain Domain r i Domain Analysis e a knowledge Implementation e m n o i (feature modeling) g D (models, source code) n E g n n o Requirements Application i i r t e Customer a Analysis Derivation e needs c Product n i l p i g p (feature selection) (generator, testing) n A E

  26. g n n i Domain Domain r i Domain Analysis e a knowledge Implementation e m n o i (feature modeling) g D (models, source code) n E g n n o Requirements Application i i r t e Customer a Analysis Derivation e needs c Product n i l p i g p (feature selection) (generator, testing) n A E

  27. IMPLEMENTATION 35

  28. g n n i Domain Domain r i Domain Analysis e a knowledge Implementation e m n o i (feature modeling) g D (models, source code) n E g n n o Requirements Application i i r t e Customer a Analysis Derivation e needs c Product n i l p i g p (feature selection) (generator, testing) n A E

  29. Runtime Parameters Parameters, variables, constants

  30. Parameter 38

  31. Parameter –i in grep 39

  32. Global configuration options class 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 }

  33. Propagating Parameters durch viele Aufrufe propagiert statt globaler Variable 41

  34. Selecting configurations • Command line parameters • Config file • User dialog • Source code • … 42

  35. class Conf { public static boolean COLORED = true ; Graph Library public static boolean WEIGHTED = false ; } class Graph { class Node { Vector nv = new Vector(); Vector ev = new Vector(); int id = 0; Edge add(Node n, Node m) { Color color = new Color(); Edge e = new Edge(n, m); void print() { nv.add(n); nv.add(m); ev.add(e); if (Conf.COLORED) if (Conf.WEIGHTED) e.weight = new Weight(); Color.setDisplayColor(color); return e; System.out.print(id); } } 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); class Edge { e.weight = w; return e; Node a, b; } Color color = new Color(); void print() { Weight weight; for ( int i = 0; i < ev.size(); i++) { Edge(Node _a, Node _b) { a = _a; b = _b; } ((Edge)ev.get(i)).print(); void print() { } if (Conf. COLORED) Color.setDisplayColor(color); } a.print(); b.print(); } if (!Conf.WEIGHTED) weight.print(); } } class Color { static void setDisplayColor(Color c) { ... } class Weight { void print() { ... } } }

  36. 199 Configuration parameters for the optimizer (1600 total)

  37. Limitations • 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? 45

  38. Limitations design • Variable code scattered in entire program pattern – Hard to test in isolation • Global variables or long parameter lists • All code always included compile- time if – Binary size, memory consumption – Performance – Unused functionality as attack vector • Changes at runtime or load-time? 46

  39. Preprocessors conditional compilation #ifdef

  40. 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_QUEUE COMPQUIET(rep, NULL ); COMPQUIET(rfp, NULL ); return (__db_no_queue_am(dbenv)); #else db_pgno_t first, last; u_int32_t flags; int empty, ret, t_ret; #ifdef DIAGNOSTIC DB_MSGBUF mb; #endif // over 100 lines of additional code } #endif 49

  41. Preprocessor in Java? • No native preprocessor • Some compilers support conditional compilation at statement level class Example { public static final boolean DEBUG = false ; void main() { System.out.println(“immer”); if (DEBUG) { System.out.println(“debug info”); printDetails(); } } void printDetails() { ... } } • External tools 50

  42. 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 51 http://weblogs.java.net/blog/tball/archive/2006/09/munge_swings_se.html

  43. Configurable Graph Library class Graph { class Edge { Vector nv = new Vector(); Vector ev = new Vector(); Node a, b; Edge add(Node n, Node m) { /*if[COLOR]*/ Edge e = new Edge(n, m); Color color = new Color(); nv.add(n); nv.add(m); ev.add(e); /*end[COLOR]*/ /*if[WEIGHT]*/ /*if[WEIGHT]*/ e.weight = new Weight(); Weight weight; /*end[WEIGHT]*/ /*end[WEIGHT]*/ return e; Edge(Node _a, Node _b) { a = _a; b = _b; } } void print() { /*if[WEIGHT]*/ /*if[COLOR]*/ Edge add(Node n, Node m, Weight w) Color.setDisplayColor(color); Edge e = new Edge(n, m); /*end[COLOR]*/ nv.add(n); nv.add(m); ev.add(e); a.print(); b.print(); e.weight = w; return e; /*if[WEIGHT]*/ } weight.print(); /*end[WEIGHT]*/ /*end[WEIGHT]*/ void print() { } for ( int i = 0; i < ev.size(); i++) { } ((Edge)ev.get(i)).print(); /*if[COLOR]*/ } class Color { } static void setDisplayColor(Color c) { ... } } } /*end[COLOR]*/ /*if[WEIGHT]*/ class Weight { void print() { ... } } class Node { /*end[WEIGHT]*/ int id = 0; /*if[COLOR]*/

  44. 10000 2000 Features Features

  45. 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

  46. class Stack { class Stack { void push(Object o void push(Object o #ifdef SYNC #ifdef SYNC , Transaction txn , Transaction txn #endif #endif ) { ) { if (o== null if (o== null #ifdef SYNC #ifdef SYNC || txn== null || txn== null #endif #endif ) return ; ) return ; #ifdef SYNC #ifdef SYNC Lock l=txn.lock(o); Lock l=txn.lock(o); #endif #endif elementData[size++] = o; elementData[size++] = o; #ifdef SYNC #ifdef SYNC l.unlock(); l.unlock(); #endif #endif fireStackChanged(); fireStackChanged(); } } } }

  47. Femto OS 56

  48. Error Prone static int _rep_queue_filedone(...) #ifdef TABLES DB_ENV *dbenv; class Table { REP *rep; void insert(Object data, __rep_fileinfo_args *rfp; { Txn txn) { #ifndef HAVE_QUEUE storage.set(data, COMPQUIET(rep, NULL ); txn.getLock()); COMPQUIET(rfp, NULL ); } return (__db_no_queue_am(dbenv)); } #else #endif db_pgno_t first, last; class Storage { u_int32_t flags; #ifdef WRITE int empty, ret, t_ret; boolean set(…) { ... } #ifdef DIAGNOSTIC #endif DB_MSGBUF mb; } #endif //over 100 lines of additional code } #endif

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend