Generative Programming


Where a reference is not included the information are from the program-transformation wiki. [1]

A synonym of Generative Programming (GP) is Program Transformation.

The goal of generative programming is to replace manual search, adaptation, and assembly of components with the automatic generation of needed components on demand. Also to increase the productivity, quality, and time-to-market in software development thanks to the deployment of both standard componentry and production automation. One important paradigm shift implied here is to build software systems from standard componentry rather than "reinventing the wheel" each time. This requires thinking in terms of system families rather than single systems. Another important paradigm shift is to replace manual search, adaptation, and assembly of components with the automatic generation of needed components on demand. Generative and component-based software engineering seeks to integrate domain engineering approaches, component-based approaches, and generative approaches.

Principles of GP

Separation of concerns. Each issue should be separated in into a distinct set of code. These pieces of code are combined to generate a needed component. AOP techniques are used to achieve this principle.

Parameterization of differences: Parameterization allows us to compactly represent families of components. Generic Programming techniques are used to parameterize over types, and iterators are used to separate out data storage and traversal aspects.

Analysis and modeling of dependencies and interactions: Not all parameter value combinations are usually valid, and the values of some parameters may imply the values of some other parameters. These dependencies are referred to as horizontal configuration knowledge, since they occur between parameters at one level of abstraction.

Separating problem space from solution space: For more Generative Software Development. Configuration knowledge is used to map between the problem space and the solution space.

Eliminating overhead and performing domain-specific optimizations: By generating components statically (at compile time), much of the overhead due to unused code, runtime checks, and unnecessary levels of indirection may be eliminated. DSLs techniques are used to improve intentionality of program code, and to enable domain-specific optimizations and error checking.

Components and GP

Generative Programming means for the application programmer that he can state what he wants in abstract terms and the generator produces the desired system or component. This works if:
(1) The implementation components fit a common product-line architecture
(2) The configuration knowledge states how to translate abstract requirements into specific components
(3) Implement the configuration knowledge using generators.

In order to come up with reusable components, we have to move our focus from single systems to system families. Development for reuse is referred to as Domain Engineering. Development with reuse, is referred to as Application Engineering.

Analysis and Design for GP

Domain Engineering
feature Modeling

Related Paradigms

Generic Programming
Aspect-Oriented Programming

See also


Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.