Generative Software Development - Examples
Transcript of Generative Software Development - Examples
![Page 2: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/2.jpg)
2
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker Matrix Library Example
![Page 3: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/3.jpg)
3
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Matrix Example: Overview
Feature Models• Implementation Components• Family Architecture• Generator
![Page 4: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/4.jpg)
4
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Domain Engineering: Analysis
• Stakeholder analysis and domain scoping• balancing market, economic, and strategic needs• GQM method, product maps, and economic model• linear or real options models (e.g., TrueScope method)
• Analysis of common and variable features and their dependencies
• Documentation using feature models (FODA)• Feature diagrams representing commonalities and variabilities in
an implementation-independent and easy-to-understand manner• Additional information documenting feature dependencies, short
descriptions, origin, rationale, defaults, binding time, usage examples, etc.
![Page 5: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/5.jpg)
5
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Feature Diagrammatrix
[element type] shape format bounds checking
rect lowerTriang
vect array
mandatory feature optional feature
alternative features
No decision regarding the mechanism for implementing variability!
upperTriang
symm
C-like Frtn-like
![Page 6: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/6.jpg)
6
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Feature Combinations
• The feature diagram contains
4 (shape) x 3 (format) x 2 (bounds checking) = 24 combinations
• Additional constraints (requires & implies) are documented separately
• Not considered: density, memory management, blocking, index base, etc.
![Page 7: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/7.jpg)
7
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
To Compare: a UML Class Diagram
Variability is implemented using concrete mechanisms, e.g.inheritance, aggregation, associations, and templates
MatrixElementType
BoundsChecking
1
0..1
LowTriRect UpTri Symm
Shape
CArrVect
Format
FArr
![Page 8: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/8.jpg)
8
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Feature-Oriented ApproachDomain analysis
MappingFamily
architecture
Problem-space view
DSL
Componenttechnology
DSLTechnology
GeneratorTechnology
Feature ModelSolution-space view
•Architectural patterns•Variability mechanisms
![Page 9: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/9.jpg)
9
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Matrix Example: Overview
• Feature ModelsImplementation Components
• Family Architecture• Generator
![Page 10: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/10.jpg)
10
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Domain Engineering: Design
• Identifying categories of implementation components• feature diagrams as a starting point
• concrete features map to concrete components• aspectual features map to aspects• abstract features to configurations of components and aspects
• a category is a set of plug-compatible components and corresponds to a concrete variation point
• Dependency analysis• analyzing use and refinement dependencies
• Architecture for the system family• GenVoca layered architecture
• lower layer parameterizes the layer above it
• GenVoca grammar
![Page 11: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/11.jpg)
11
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Implementation Components
BoundsChecking:
BoundsChecker
Symmetry:
Symm
ArrFormat
Format:
LoTriVecFormat
UpTriVecFormat
Matrix:
Matrix
Container:
D1Container
D2CContainer
D2FContainer
![Page 12: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/12.jpg)
12
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Dependency Analysis
BoundsChecking
Symmetry
Format
Container
Matrix
Container
SymmetryFormat
BoundsChecking
Matrix
![Page 13: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/13.jpg)
13
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Matrix Example: Overview
• Feature Models• Implementation Components
Family Architecture• Generator
![Page 14: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/14.jpg)
14
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
GenVoca Layered Architecture
Homepage of the GenVoca Project,www.cs.utexas.edu/users/schwartz
Notation from Czarnecki&Eisenecker, Generative Programming, 2000
MatrixType: Matrix
BoundsChecking: BoundsChecker
Symmetry: Symm
Format: ArrFormat | LoTriVecFormat | UpTriVecFormat
Container: D1Container | D2CContainer | D2FContainer
Configuration: ElementType, Matrix, Format, ...
![Page 15: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/15.jpg)
15
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
GenVoca Grammar
MatrixType: Matrix[OptBoundsCheckedMatrix]OptBoundsCheckedMatrix: OptSymmMatrix |
BoundsChecker[OptSymmMatrix]OptSymmetricMatrix: Format | Symm[Format]Format: ArrFormat[Array] |
LoTriVecFormat[Vector] |UpTriVecFormat[Vector]
Array: D2CContainer[Config] |D2FContainer[Config]
Vector: D1Container[Config]Config: MatrixType, ElementType,
IndexType, Format, ...
![Page 16: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/16.jpg)
16
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Matrix Components
template<class Config_>class D1Container{public:
typedef typename Config_ Config;typedef typename Config::ElementType ElementType;typedef typename Config::IndexType IndexType;//...const ElementType& getElement(const IndexType&) const;void setElement(const IndexType&, const ElementType&);const IndexType& size() const;
private:IndexType size_;ElementType *pData_;
};
![Page 17: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/17.jpg)
17
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Matrix Components -Forwarding Adapter
template<class Vector>class LoTriangVecFormat{public:
typedef typename Vector::Config Config;typedef typename Config::ElementType ElementType;typedef typename Config::IndexType IndexType;
private:const IndexType order_;Vector elements_;
public://...void setElement(
const IndexType & i, const IndexType & j, const ElementType & v){ if (i >= j) elements_.setElement(getIndex(i, j), v);
else assert(v == ElementType( 0 ));}//...
};
![Page 18: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/18.jpg)
18
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Matrix Components - Mixin
template<class OptSymmMatrix>class BoundsChecker : public OptSymmMatrix{public:
typedef typename OptSymmMatrix::Config Config;typedef typename Config::ElementType ElementType;typedef typename Config::IndexType IndexType;//...ElementType getElement(const IndexType& i,
const IndexType& j) const{ checkBounds(i, j);
return OptSymmMatrix::getElement(i, j);}
private:void checkBounds(const IndexType & i, const IndexType & j) const;
};
![Page 19: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/19.jpg)
19
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Configuration
// lower symmetric matrix of floats stored in a vector// with bounds checking struct C1{
typedef float ElementType;typedef unsigned long IndexType;typedef CCommaInitializer CommaInitializer;
// MatrixTypetypedef Matrix<
BoundsChecker<Symm<
LoTriVecFormat<D1Container<C1> > > > > MatrixType;
};
![Page 20: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/20.jpg)
20
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Manual Configuration
• Manually writing 24 configuration repositories is tedious and error prone
• Not all combinations of components are valid
• How to automatically produce valid configurations?Configuration generators
![Page 21: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/21.jpg)
21
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Matrix Example: Overview
• Feature Models• Implementation Components• Family Architecture
Generator
![Page 22: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/22.jpg)
22
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Deriving a Configuration DSL
ElementType: float | double | long double | ...Shape: rect | lowerTriang | upperTriang | symmOptFlag: speed | spaceBoundsCheck: true | falseFormat: vector | cArray | fArrayIndexType: char | short | int | long | unsigned int | ...
matrix
[element type] shape format bounds checking
rect lowerTriang
vect arrayupperTriang
symm
C-like Frtn-like
Derivation process• feature diagrams as a starting point• user-specific view• opportunity for introducing new abstract features• determining feature defaults• ordering according to frequency of use• renesting to maximize specification efficiency and safety
![Page 23: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/23.jpg)
23
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Simulating Keyword-Template-Parameters
• Keyword-Template-Parameters can be simulated using wrapper templates• Parameters can be specified in any order• Can use the default value of any parameter (not only the last ones)
• Example• MatrixGenerator< ElemType<double>, Shape<lower_triang> >::RET• MatrixGenerator<Optimize<speed>, Shape<upper_triang>,
ElemType<double> >::RET
• See implementation details athttp://www.generative-programming.org/namedparams/
![Page 24: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/24.jpg)
24
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Configuration Generator
template< class P1= Nil,class P2= Nil,class P3= Nil,class P4= Nil,class P5= Nil,class P6= Nil >
struct MatrixGenerator{ // define a short name for the complete generator
typedef MatrixGenerator<P1,P2,P3,P4,P5,P6> Generator;// compute parameter defaults (and check combinations)typedef ComputeMatrixParamDefaults<P1,P2,P3,P4,P5,P6> Params;typedef Params::ElementType ElementType_;typedef Params::IndexType IndexType_;enum{ shape = Params::shape,
format = Params::format,boundsChecking = Params::boundsChecking,isSymmetric = shape==symm,
};
![Page 25: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/25.jpg)
25
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Configuration Generator
// assemble componentstypedef SWITCH<format,
CASE<cArray, D2CContainer<Generator>,CASE<fArray, D2FContainer<Generator>,CASE<vector, D1Container<Generator>
> > > >::RET Container_//...typedef IF<isSymmetric,
Symm<Format>,Format>::RET OptSymmetricMatrix;
typedef IF<boundsChecking,BoundsChecker<OptSymmetricMatrix>,OptSymmetricMatrix>::RET OptBoundsCheckedMatrix;
typedef Matrix<OptBoundsCheckedMatrix> RET; // complete matrix type
![Page 26: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/26.jpg)
26
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Computing Format
//**********************************************************************typedef EVAL_DEPENDENCY_TABLE //Format (see Table 14-7)
//**********************************************************************< CELL< shape, CELL< format > >//**********************************************************************, ROW< CELL< lowerTriang, CELL< vector, RET< LoTriangVecFormat<Vector> > > >, ROW< CELL< symm, CELL< vector, RET< LoTriangVecFormat<Vector> > > >, ROW< CELL< upperTriang, CELL< vector, RET< UpTriangVecFormat<Vector>> > >, ROW< CELL< anyValue, CELL< anyValue,RET< ArrFormat<Array> > > >//**********************************************************************> > > > >::RET Format;
![Page 27: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/27.jpg)
27
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
C++ Template Metaprogramming
• C++ templates define a Turing-complete, functional language executed at compile time ( Erwin Unruh, Todd Veldhuizen)
• C++ as a heterogeneous two-level language• C-like control structures IF, SWITCH, DO, WHILE, FOR available
• Czarnecki, Eisenecker: Generative Programming - Methods, Techniques, and Applications. Addison Wesley, 2000
• www.boost.org
• Comparison to other languages supporting metaprogramming• K. Czarnecki, J. O’Donnel, J. Striegnitz, W. Taha. DSL Implementation in
MetaOCaml, Template Haskell, and C++. In Domain-Specific Program Generation, LNCS 3016, Springer-Verlag, 2004, http://www.swen.uwaterloo.ca/~kczarnec/dagstuhl04.pdf
![Page 28: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/28.jpg)
28
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Configuration Generator
// generating configuration repositorystruct Config
{ //DSL featurestypedef Params DSLFeatures;//features required by componentstypedef ElementType_ ElementType;typedef IndexType_ IndexType;typedef CommaInitializer_ CommaInitializer;//MatrixTypetypedef RET MatrixType;
};// the configuration repository is a part of each product; i.e., it // can be accessed by other generators (e.g. for generating // customized algorithms)
![Page 29: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/29.jpg)
29
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
A Small Change Still Needed...
template<class Generator> // Generator instead of Configclass D1Container{public:
typedef typename Generator::Config Config; typedef typename Config::ElementType ElementType;//...
};
// D2CContainer...
// D2FContainer...
![Page 30: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/30.jpg)
30
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Usage
typedefMatrixGenerator<>::RETM1; // give me a default one
typedefMatrixGenerator<ElementType<float>,
Shape<upperTriang>,OptFlag<speed> >::RET M2;
typedefMatrixGenerator<BoundsChecking<false>,
ElementType<long double> >::RET M3;
// ...M1 m1(3,3); M2 m2(3,3); M3 m3(3,3);// ...
![Page 31: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/31.jpg)
31
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Usage
//initialization using a comma-separated listm1= 1, 0, 3,
0, 1, 4,2, 0, 1
//...
//evaluate a matrix expressionm1= m2 + m3 + m2;
//print the resultcout << "m1 = " << endl << RectMatrix1 << endl;
![Page 32: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/32.jpg)
32
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Applications
• Matrix Template Library (MTL)• University of Notre Dame, USA• currently the fastest generic matrix library in C++• incorporated the generative design of GMCL as an extra
layer• http://www.lsc.nd.edu/
• Adapter Iterator Library• contains a set of generators for creating STL-conforming
iterator adapters• http://www.boost.org
![Page 33: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/33.jpg)
33
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Technology Projection - C++ Templates
DSL encoded in C++itself using• constants• types• templates
Template metaprogrammingin C++
Generic programmingin C++
Problem Space• Domain-specific
concepts and• Features
Solution Space• Elementary
components• Maximum
combinability• Minimum
redundancy
Configuration Knowledge• Illegal feature combinations• Default settings• Default dependencies• Construction rules• Optimizations
![Page 34: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/34.jpg)
34
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
On-Board Satellite Software Example
![Page 35: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/35.jpg)
35
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Problem
• Satellite On-Board Software• Several functions, e.g., attitude and orbit control, thermal
control, power management, data handling• Organized as a set of applications that communicate through
packets• Services for monitoring/housekeeping, transmission control,
storage control etc.• On-Board Data-Handling System (OBDHS)• Packet Utilization Standard (PUS) – European Space Agency
• Goal• Software system family engineering instead of one-of-a-kind
development• Implementation of PUS as a generative toolkit
![Page 36: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/36.jpg)
36
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Proposed Technology Projection
Specification of a systemconfiguration usinga graphical editor(checks and completesthe specification)
Configurationdefinitionin XML
Generation of variableparts of the architecturein Ada 83 using thetemplate language TL
Architecture frameworkin Ada83
Problem Space• Domain-specific
concepts and• Features
Solution Space• Elementary
components• Maximum
combinability• Minimum
redundancy
Configuration Knowledge• Illegal feature combinations• Default settings• Default dependencies• Construction rules• Optimizations
![Page 37: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/37.jpg)
37
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Product line definition(feature model in
XML format)
General-purposeconfiguration
editor
Satelliteconfiguration
in XML
SatelliteProduct LineArchitecture
(Ada83 + Templates)
Concrete Satellite
Ground station
Generatesave
load
Staticallyconfigure
Dynamicallyconfigure
Communi-cation
Technology Projection - Overview
![Page 38: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/38.jpg)
38
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Product line definition(feature model in
XML format)
Overview - Feature Model
General-purposeconfiguration
editor
Satelliteconfiguration
in XML
SatelliteProduct LineArchitecture
(Ada83 + Templates)
Concrete Satellite
Ground station
Generatesave
load
Staticallyconfigure
Dynamicallyconfigure
Communi-cation
![Page 39: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/39.jpg)
39
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Satellite Feature Model Using AmiEddi
![Page 40: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/40.jpg)
40
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Overview - Configuration Editor
Product line definition(feature model in
XML format)
General-purposeconfiguration
editor
Satelliteconfiguration
in XML
SatelliteProduct LineArchitecture
(Ada83 + Templates)
Concrete Satellite
Ground station
Generatesave
load
Staticallyconfigure
Dynamicallyconfigure
Communi-cation
![Page 41: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/41.jpg)
41
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
ConfigEditor
Adding features Adding features
![Page 42: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/42.jpg)
42
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Overview - Product Line Architecture
Product line definition(feature model in
XML format)
General-purposeconfiguration
editor
Satelliteconfiguration
in XML
SatelliteProduct LineArchitecture
(Ada83 + Templates)
Concrete Satellite
Ground station
Generatesave
load
Staticallyconfigure
Dynamicallyconfigure
Communi-cation
![Page 43: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/43.jpg)
43
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
main computer e.g. 1750 processor
up/d
own
link packet router
Application x1 interface
serviceimplementation
x1
...service
implementationxn
Application xn
...
on-b
oard
bus
Telemetry packet
Telecommand packet
Satellite Product Line Architecture - Overview
![Page 44: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/44.jpg)
44
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Template Language• Templates - source code instrumented with preprocessor directives• The directives accesses information in a XML configuration file• Automatic generation of a program generator form the templates
XML file withconfiguration information
Specialized program generator
Finished (Ada) source code
(Ada) source code instrumented withtemplate language directives
Program generator generator
generates
Craig Cleaveland, Program Generators with XML and Java.Prentice-Hall 2001, http://craigc.com
![Page 45: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/45.jpg)
45
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Template Language -Selection
#if "/satellite/definition/transmissioncontrol" ='true'#with transmissioncontrol;
#fi#
separate(app)
procedure send(o :ptr; p :in out pus.ptr) istransmission :boolean :=true;
begin
#if "/satellite/definition/transmissioncontrol" ='true'#transmission :=transmissioncontrol.exec(o.transControl, p);
#fi#
if transmission thenpacketrouter.send(p);
end if;end send;
![Page 46: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/46.jpg)
46
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Template Language -Expressions
• Getting a constant from the XML configuration
MAX_STORAGE_OBJECTS: constant integer:= #"//Attribute[@Name='MAX_STORAGE_OBJECTS']/attribute::Value"# ;
• Counting nodes
MAX_APPS: constant integer:= #"count(//App)"#;
![Page 47: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/47.jpg)
47
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
#for i "/Satellite/PUS/Service/Sub"#with service#"$i/../id"#_#"$i/id"#;#end#
separate (app)procedure decode(o :in out ptr ; p :in ...) isno_service : exception; ...
beginfor i in o.service'range loop...
end loop;...
case s.typ is#for i "/Satellite/PUS/Service"#
when #"$i/id"# =>case s.sub is#for j "$i/Sub"#when #"$j/id"# => service#"$j/../id"#_#"$j/id"#(o, p);
#end#when others => null;end case;
#end#when others => null;
end case;
exception...
end decode;
with service014_001;with service014_002;with service001_001;with service001_002;with service001_007;with service001_009;with service004_023;with service004_024;with service004_025;with service004_026;separate (app)procedure decode(o :in out ptr ; p :in
...) isno_service : exception;....
beginfor i in o.service'range loop...
end loop;... case s.typ iswhen 014 =>case s.sub iswhen 001 => service014_001(o, p);when 002 => service014_002(o, p);when others => null;
end case;when 001 =>case s.sub iswhen 001 => service001_001(o, p);when 002 => service001_002(o, p);when 007 => service001_007(o, p);when 009 => service001_009(o, p);when others => null;
end case; when 004 =>case s.sub iswhen 023 => service004_023(o, p);when 024 => service004_024(o, p);when 025 => service004_025(o, p);when 026 => service004_026(o, p);when others => null;
end case; when others => null;
end case;exception...
end decode;
Template Language -Iteration
![Page 48: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/48.jpg)
48
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Overview – Generated System
Product line definition(feature model in
XML format)
General-purposeconfiguration
editor
Satelliteconfiguration
in XML
SatelliteProduct LineArchitecture
(Ada83 + Templates)
Concrete Satellite
Ground station
Generatesave
load
Staticallyconfigure
Dynamicallyconfigure
Communi-cation
![Page 49: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/49.jpg)
49
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Satellite Simulation Environment
Satellite monitoring panel Satellite monitoring panel
Ground station sender Ground station sender Ground station receiver Ground station receiver
![Page 50: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/50.jpg)
50
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Automotive Embedded Software Example
![Page 51: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/51.jpg)
51
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Software Technology Progress in the Automotive Industry
• Electronic control units (ECUs)• Low-resource microprocessors (8/16/32 bit, kB RAM/ROM)
• In the past: ECUs programming in assembly• Around 1985: switch to C
• Initially developers studied the assembly produced by the compiler• No one does this anymore• Compiler errors are still found from time to time
• Model-Based Development using Matlab/Simulink/Stateflow• Simulink - time-continuous, signal flow• Stateflow - reactive parts, state charts• simulation (SIL, HIL)• code generation (“autocoding”)
![Page 52: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/52.jpg)
52
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Control Systems: Visual Formalisms: Statecharts
![Page 53: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/53.jpg)
53
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Control Systems: Visual Formalisms: Block Diagrams
![Page 54: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/54.jpg)
54
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Simulation
![Page 55: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/55.jpg)
55
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Code Generation
![Page 56: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/56.jpg)
56
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Model-Based Development of Automotive Embedded Software
Standard Components(OS, Network Management,Diagnosis, Flashing, etc.)
Firmware
Application Code(Control Functions)
Control Functions• Modeling and Simulation
(Matlab/Simulink/Stateflow)• Production code generation
(TargetLink, Real Time Workshop)
CAN Bus
Standard Components• Configuration using a GUI-
based editor• Template-based code
generation Electronic Control Unit
HardwareDynamic configuration(Calibration)
Static configuration
![Page 57: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/57.jpg)
57
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Structure Spectrum of DSLs
Routine configuration Creative construction
matrix
[element type] shape format bounds checking
rect lowerTriang
vect arrayupperTriang
symm
C-like Frtn-like
scr1
scr2 scr3
scr4scr7 scr8
scr5scr6
scr11 scr12scr9 scr10
Path through a decision tree Subtree of a feature treeSubgraph of an(infinite) graph
Wizards Feature-basedconfiguration
Graph-like language(with user-defined elements)
![Page 58: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/58.jpg)
58
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker Summary & Discussion
![Page 59: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/59.jpg)
59
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Key Concepts in Generative Software Development
• Software system families• Cornerstone of systematic software reuse
• Feature modeling• Family scoping, DSL & architecture development
• Domain-specific languages• Optimal support for application developers
• Mappings• Design knowledge capture
![Page 60: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/60.jpg)
60
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Relation To Other Fields
System Families, Product Lines
Configuration KnowledgeProblem Space Solution Space
Components
Architectures
Generic programming
Aspect-oriented programming
Feature modeling, feature interactions
Domain-specific languagesGenerators/Transformers
Aspect-oriented modeling
![Page 61: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/61.jpg)
61
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Generic vs. Generative
• Generic• "relating to or characteristic of a whole group or
class" (Merriam-Webster Online)• Solution space technique for developing parametrized
components• Generative
• "having the power or function of generating, originating, producing, or reproducing" (Merriam-Webster Online)
• System for producing other systems; it comprises problem space, configuration knowledge, and solution space
![Page 62: Generative Software Development - Examples](https://reader033.fdocuments.in/reader033/viewer/2022041506/6252466aa3eacb19a06dfa8b/html5/thumbnails/62.jpg)
62
©19
99-2
004
K. C
zarn
ecki
& U
. Ei
sene
cker
Discussion