In our earlier article, we have explained that generative programming is a programming paradigm in methodical software development. Characteristic of generative programming is the automatic generation of program code by a generator. The basis for automatically generated code is the abstraction of frequently occurring program constructs in formal models.

UML
UML allows the creation of a software architecture in the form of a diagram. This can then be used to automatically generate code, which usually has to be completed “by hand”. More demanding development environments also allow simultaneous work at the UML and source code level. You can change either the UML or the source code and the development environment will automatically create the different representation of the program. This means that either UML code is generated from the source code or vice versa.
---
Using XML and XSLT
Automatic code generation is also possible with XSLT. The desired model is displayed in an XML document, the syntax of which you can declare yourself. Then you create an XSLT script that matches the XML document and generates the program code. This can also be done in a multi-step process, e.g. an initial XSLT script is used to generate a batch file, a shell script, or a makefile with a list of additional XSLT processing steps or other commands.
Form generators
On the basis of a list-like description of the table structure, a screen mask is created from specific tables. The structure and functionality of the form is predetermined. However, the different tables differ in the type and number of fields, field labels, types, and foreign key relationships.
Compiler
For example, the syntax of a programming language is specified in EBNF notation. Based on this formal language definition, a compiler creates the compiler, or a parser generator creates the parser for the specified language.
Product configuration
Generative programming can also be used to process BOMs with variable BOM items. As part of customizing or installation, generative programs can bring the variant configuration of complex software applications to the desired target form.
Rapid Control Prototyping
In rapid control prototyping, a code adapted to the ECU is generated from block diagrams in control engineering, so that errors in the conversion of block diagrams into ECU-specific code are avoided as far as possible.
Tagged With group1tj