Generative Programming (GP), as introduced in late 1990-ies, is a discipline of Automatic Programming, which is originally based on several other disciplines:
– Object Oriented Programming
– Generic Programming
– Metaprogramming
– Aspect Oriented Programming
– Domain Engineering
The intention of GP was to enable much more flexibility in the development process of generators and target program applications. For example, why use only one generator for the whole program solution when we can use several generators fully adapted to the specific needs of the application to be built? What about reusability of generators, how can they be adapted to fulfil the needs of new similar projects?
Although the original concept of GP has offered some interesting solutions and even the whole development frameworks, it was still suffering from suffered from a lack of flexibility, caused by the rigidity of OOP model. Also, UML has not proven suitable for designing generators, especially in the part related to the modeling of aspects.
GP based on scripting languages
Scripting languages strive to be typeless, suitable for gluing different components, use flexible data structures and they are interpreted, enabling execution of programming code from the variables, ass well as from programming pieces named scripts. Why don’t we use scripting languages in building of code generators, or, even better, simultaneous development of generators and target applications?
Started from these assumptions, a group of teachers from the University of Zagreb, Croatia, started in the early 2000-s with the development of generators based on scripting languages. The concept was firstly named SGM (Scripting Generator Model). SGM introduced graphic diagrams aimed specifically for modeling generators. The Specification Diagram defines features of target application to be generated and their hierarchy, while The Configuration Diagram defines the dispersion of these features (i.e. aspects) on the different application parts.
The model was in the late 00-s upgraded to the SCT generator model. SCT offers full configurability, so the configuration need not to be programmed, as earlier, but specified using appropriate syntax. Based on SCT, the Autogenerator was built in the early 2010-s. Autogenerator uses the possibility of scripting languages to evaluate the programming code from variables, not only from program scripts. The program code in scripting language (we used Python) is being generated on demand and executed immediately. This concept allows some advantages like changing program Specification on the fly, while the program is working, some level of introspection, so the programmer can see which parts of Specification, Configuration and Templates are being currently in use, adaptation of program dependencies on the fly, like adding/deleting some database column and, finally, usage of Dynamic Specification. Dynamic Specification represents the possibility of using heterogenous data structures inside the existing database structure with automatic code generation to handle them.
What do we offer in these pages?
Our intention is to present our own achievements in building generators and related systems, together with the achievements of our colleagues from various parts of the world. For us, Generative Programming is a great concept, which is unjustifiably neglected in the recent years. Besides, there are so many innovations in the field of teaching in informatics, machine learning and all other fields of automatization, so let’s generate, make the things generative!