![Page 1: Software product lines Paulo Borba Informatics Center Federal University of Pernambuco](https://reader035.vdocuments.mx/reader035/viewer/2022081519/56649e865503460f94b891a9/html5/thumbnails/1.jpg)
Software product lines
Paulo BorbaInformatics Center
Federal University of Pernambuco
![Page 2: Software product lines Paulo Borba Informatics Center Federal University of Pernambuco](https://reader035.vdocuments.mx/reader035/viewer/2022081519/56649e865503460f94b891a9/html5/thumbnails/2.jpg)
Variability implementation mechanisms
Paulo BorbaInformatics Center
Federal University of Pernambuco
![Page 3: Software product lines Paulo Borba Informatics Center Federal University of Pernambuco](https://reader035.vdocuments.mx/reader035/viewer/2022081519/56649e865503460f94b891a9/html5/thumbnails/3.jpg)
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
![Page 4: Software product lines Paulo Borba Informatics Center Federal University of Pernambuco](https://reader035.vdocuments.mx/reader035/viewer/2022081519/56649e865503460f94b891a9/html5/thumbnails/4.jpg)
Pre-processing followed by compilation
canvas_midp2, device_screen_128x128,...
Tags file
Antenna file
product
![Page 5: Software product lines Paulo Borba Informatics Center Federal University of Pernambuco](https://reader035.vdocuments.mx/reader035/viewer/2022081519/56649e865503460f94b891a9/html5/thumbnails/5.jpg)
CC Core assets
canvas_midp2, device_screen_128x128,...
Antenna file
canvas_siemens, device_screen_128x128,...
Tags files
Makefiles
![Page 6: Software product lines Paulo Borba Informatics Center Federal University of Pernambuco](https://reader035.vdocuments.mx/reader035/viewer/2022081519/56649e865503460f94b891a9/html5/thumbnails/6.jpg)
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
![Page 7: Software product lines Paulo Borba Informatics Center Federal University of Pernambuco](https://reader035.vdocuments.mx/reader035/viewer/2022081519/56649e865503460f94b891a9/html5/thumbnails/7.jpg)
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 {//#endifprivate 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
![Page 8: Software product lines Paulo Borba Informatics Center Federal University of Pernambuco](https://reader035.vdocuments.mx/reader035/viewer/2022081519/56649e865503460f94b891a9/html5/thumbnails/8.jpg)
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
![Page 9: Software product lines Paulo Borba Informatics Center Federal University of Pernambuco](https://reader035.vdocuments.mx/reader035/viewer/2022081519/56649e865503460f94b891a9/html5/thumbnails/9.jpg)
Parametrization via property files (PFP)
Properties p = new Properties();p.load(new FileInputStream("device_screen.prop"));...
p.getProperty("SCREEN_WIDTH")...
SCREEN_WIDTH=128SCREEN_HEIGHT=128
device_screen.prop
![Page 10: Software product lines Paulo Borba Informatics Center Federal University of Pernambuco](https://reader035.vdocuments.mx/reader035/viewer/2022081519/56649e865503460f94b891a9/html5/thumbnails/10.jpg)
PFP core assets
SCREEN_WIDTH=128SCREEN_HEIGHT=128
device_screen.prop
Java file
Makefiles
SCREEN_WIDTH=128SCREEN_HEIGHT=117
device_screen.prop
Property files
![Page 11: Software product lines Paulo Borba Informatics Center Federal University of Pernambuco](https://reader035.vdocuments.mx/reader035/viewer/2022081519/56649e865503460f94b891a9/html5/thumbnails/11.jpg)
Properties provide data and behavior too
Properties p = new Properties();p.load(new FileInputStream("device_screen.prop"));... if (p.getProperty("SCREEN_WIDTH")==128) {
... } else {...}...
![Page 12: Software product lines Paulo Borba Informatics Center Federal University of Pernambuco](https://reader035.vdocuments.mx/reader035/viewer/2022081519/56649e865503460f94b891a9/html5/thumbnails/12.jpg)
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
![Page 13: Software product lines Paulo Borba Informatics Center Federal University of Pernambuco](https://reader035.vdocuments.mx/reader035/viewer/2022081519/56649e865503460f94b891a9/html5/thumbnails/13.jpg)
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
![Page 14: Software product lines Paulo Borba Informatics Center Federal University of Pernambuco](https://reader035.vdocuments.mx/reader035/viewer/2022081519/56649e865503460f94b891a9/html5/thumbnails/14.jpg)
Adaptive object-model
![Page 15: Software product lines Paulo Borba Informatics Center Federal University of Pernambuco](https://reader035.vdocuments.mx/reader035/viewer/2022081519/56649e865503460f94b891a9/html5/thumbnails/15.jpg)
Parametrization via parametric polymorphism (PPP)public class Record<ComplaintType> { ... public void insert(ComplaintType o) {
... }}
...Record<HealthComplaint>
...
![Page 16: Software product lines Paulo Borba Informatics Center Federal University of Pernambuco](https://reader035.vdocuments.mx/reader035/viewer/2022081519/56649e865503460f94b891a9/html5/thumbnails/16.jpg)
PPP core assetsJava file, generic
Makefiles
Java files, specific...
Record<HealthComplaint>...
...Record<SafetyComplaint>
...
![Page 17: Software product lines Paulo Borba Informatics Center Federal University of Pernambuco](https://reader035.vdocuments.mx/reader035/viewer/2022081519/56649e865503460f94b891a9/html5/thumbnails/17.jpg)
Parametrizing data + operations
public class Record< ComplaintType extends CodeIdentifiable> { ... public ComplaintType search(int code){ ... } public void insert(ComplaintType o) {
... }} interface CodeIdentifiable {
int getCode();}
![Page 18: Software product lines Paulo Borba Informatics Center Federal University of Pernambuco](https://reader035.vdocuments.mx/reader035/viewer/2022081519/56649e865503460f94b891a9/html5/thumbnails/18.jpg)
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
![Page 19: Software product lines Paulo Borba Informatics Center Federal University of Pernambuco](https://reader035.vdocuments.mx/reader035/viewer/2022081519/56649e865503460f94b891a9/html5/thumbnails/19.jpg)
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)
![Page 20: Software product lines Paulo Borba Informatics Center Federal University of Pernambuco](https://reader035.vdocuments.mx/reader035/viewer/2022081519/56649e865503460f94b891a9/html5/thumbnails/20.jpg)
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)
![Page 21: Software product lines Paulo Borba Informatics Center Federal University of Pernambuco](https://reader035.vdocuments.mx/reader035/viewer/2022081519/56649e865503460f94b891a9/html5/thumbnails/21.jpg)
Same modularization mechanism, 3 decision mechanisms: Makefiles Makefiles + property_files +
conditionals Input + conditionals
![Page 22: Software product lines Paulo Borba Informatics Center Federal University of Pernambuco](https://reader035.vdocuments.mx/reader035/viewer/2022081519/56649e865503460f94b891a9/html5/thumbnails/22.jpg)
Variability implementation mechanisms
Paulo BorbaInformatics Center
Federal University of Pernambuco