Template-based code generation (TBCG) is a generative technology that transforms data into structured text, e.g. code, through the use of templates. The data, referred to as the model, represents an abstract design while the templates provide the mold of the target code used by the generator in the process of code production. A classical template is a mixture of text blocks and imperative control code segments. The text blocks’ concern is to describe textual patterns while the control code’s is to retrieve, manipulate, and substitute the data into place holders within the text. The mixture of these concerns reduces the readability, expressiveness, reusability, and analyzability of the textual patterns and the control code alike. We introduce the projector templates, a TBCG technology that adheres to separation of concerns of the template, model, and the template control code. Inspired by the relational theory, projective template blocks are treated as annotated relations that can derive their input from the source model through the use of relational operators. The projector templates are thus code-free, coherent, their transformation process reusable, and capable of elegantly coping with complex code-generation scenarios.
[1]
Aniruddha S. Gokhale,et al.
Infrastructure for component-based DDS application development
,
2011,
GPCE '11.
[2]
R. Taylor,et al.
A Rationalization of Confusion , Challenges , and Techniques in Model-Based Software Development
,
2011
.
[3]
F. E..
A Relational Model of Data Large Shared Data Banks
,
2000
.
[4]
C. Henthorne,et al.
Code Generation on Steroids: Enhancing COTS Code Generators via Generative Aspects
,
2007,
Second International Workshop on Incorporating COTS Software into Software Systems: Tools and Techniques (IWICSS '07).
[5]
Terence Parr.
A Functional Language For Generating Structured Text
,
2006
.
[6]
Daniel Jackson,et al.
Software Abstractions - Logic, Language, and Analysis
,
2006
.
[7]
Stan Jarzabek,et al.
Software Reuse Beyond Components with XVCL
,
2007
.
[8]
Emina Torlak,et al.
A constraint solver for software engineering: finding models and cores of large relational specifications
,
2009
.
[9]
Terence John Parr,et al.
Enforcing strict model-view separation in template engines
,
2004,
WWW '04.