Task: Implement generator
The generator is build as a layer betwen framework and modeling language in DSM.
Disciplines: Development
Purpose
We need an interface between modling language and domain framework.
Relationships
RolesPrimary Performer: Additional Performers:
InputsMandatory:
    Optional:
      Outputs
        Main Description
        Generator is an application which take some input (usually in an object structure) and produce some kind of output. It can be built only when both sides are known and well defined. Building of generator is one of the most challening task to be done in DSM practice. It's build for a specific purpose, however it have to be very well prepared as generated code is not checked, but instead executable. Very often process of building generators is supported by using best practics and patterns.
        Steps
        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.
        Key Considerations
        We need the modeling language to allows us to capture all the informations (concepts) we need to build working application. We have to be sure that domain framework is well defined. Generators should be distributed and versioned with the modeling language. Big generators should be divided on the smaller ones. On the base of file types to be generated or model type.
        More Information