Download presentation
Presentation is loading. Please wait.
Published byVirginia Bishop Modified over 9 years ago
1
Software product lines Paulo Borba Informatics Center Federal University of Pernambuco
2
Variability implementation mechanisms Paulo Borba Informatics Center Federal University of Pernambuco
3
Conditional compilation //#if canvas_midp2 || canvas_siemens //#this.mainCanvas.paint(); //#this.mainCanvas.flushGraphics(); //#else //# this.mainCanvas.repaint(); //# this.mainCanvas.serviceRepaints(); //#endif From Meantime Mobile Creations
4
Pre-processing followed by compilation canvas_midp2, device_screen_128x128,... Tags file Antenna file product
5
CC Core assets canvas_midp2, device_screen_128x128,... Antenna file canvas_siemens, device_screen_128x128,... Tags files Makefiles
6
Inside commands... if (display.getCurrent()==this.mainCanvas) { //#if canvas_midp2 || canvas_siemens //#this.mainCanvas.paint(); //#this.mainCanvas.flushGraphics(); //#else //#this.mainCanvas.repaint(); //#this.mainCanvas.serviceRepaints(); //#endif } From Meantime Mobile Creations
7
and everywhere //#if canvas_nokiaui //# public class MainCanvas extends FullCanvas { //#elif canvas_midp2 || canvas_siemens //# public class MainCanvas extends GameCanvas { //#else //# public class MainCanvas extends Canvas { //#endif private static int keyStatesNotRepeatable; //#if device_screen_128x128 //# public static final int SCREEN_WIDTH = 128; //# public static final int SCREEN_HEIGHT = 128; //#elif device_screen_128x117 //# public static final int SCREEN_WIDTH = 128;... From Meantime Mobile Creations
8
Analyzing conditional compilation Variation point any point in the program text Variation any program element Binding time precompilation time Mechanism decision based on tags file, specified by makefile
9
Parametrization via property files (PFP) Properties p = new Properties(); p.load(new FileInputStream("device_screen.prop"));... p.getProperty("SCREEN_WIDTH")... SCREEN_WIDTH=128 SCREEN_HEIGHT=128 device_screen.prop
10
PFP core assets SCREEN_WIDTH=128 SCREEN_HEIGHT=128 device_screen.prop Java file Makefiles SCREEN_WIDTH=128 SCREEN_HEIGHT=117 device_screen.prop Property files
11
Properties provide data and behavior too Properties p = new Properties(); p.load(new FileInputStream("device_screen.prop"));... if (p.getProperty("SCREEN_WIDTH")==128) {... } else {...}...
12
Analyzing PFP Variation point expressions in the program text, and commands too (with conditionals) Variation constants and values, commands Binding time execution time, based on makefile choice Mechanism value instantiation, decision
13
Adaptive object models Several OO patterns But not only subtype polymorphism Metadata plays an essential role Supports flexible dynamic adaptations Represents business rules and entities as data POS performs a sequence of actions; the actions and sequence are represented as objects
14
Adaptive object-model
15
Parametrization via parametric polymorphism (PPP) public class Record {... public void insert(ComplaintType o) {... }... Record...
16
PPP core assets Java file, generic Makefiles Java files, specific... Record... Record...
17
Parametrizing data + operations public class Record< ComplaintType extends CodeIdentifiable> {... public ComplaintType search(int code){... } public void insert(ComplaintType o) {... } interface CodeIdentifiable { int getCode(); }
18
Analyzing PPP Variation point class parameters (types and methods) in the program text Variation types (including methods) Binding time compilation time, based on makefile choice Mechanism type instantiation, variation modularization
19
Mixing mechanisms: PPP, but instantiation with PFP and conditional Variation point class parameters (types and methods) in the program text Variation types (including methods) Binding time execution time, based on makefile choice Mechanism type and value instantiation, variation modularization, decision (conditional)
20
Mixing mechanisms: PPP, with conditional and input parameter Variation point class parameters (types and methods) in the program text Variation types (including methods) Binding time execution time, based on user choice Mechanism type and value instantiation, variation modularization, decision (conditional)
21
Same modularization mechanism, 3 decision mechanisms: Makefiles Makefiles + property_files + conditionals Input + conditionals
22
Variability implementation mechanisms Paulo Borba Informatics Center Federal University of Pernambuco
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.