Decide what to generate
We need to identify the code that have to be generated. The simplest way is to get sample aplication and paste it as
an output of generator. |
Create example model
Create model representation in our new domain specific language for code that we have to generate. |
Reduce generator
Remember to keep generator as simple as possible
-
Find sections that are repeted in output code, and change them into one occurance using loops.
-
Surround sections in the template (which stands for conditionals in the model) with generator code.
-
Replace places in the template which stands for model variables.
|
Compare model and language
Try to make few changes (like changes in names, or creating new objects) in model and then make sure that
generated code reflected them. Repair bugs.
|
Build application
Because first application was already written before we stareted to create generator, try to model and generate the other
one. |
|