Root CUIP Metalevel

Posts tagged “stringtemplate”.

StringTemplate: a great template engine for code generation

Paper Templates, licensed CC Attribution by Edinburgh City of Print

When building a new tool for modelling and code generation like Essential, one has to rethink again what template engine use to drive all the machinery. In code generation contexts, template engines are a good field for innovation and your choice will be with you probably for the full lifetime of your tool.

In this post, I will try to introduce and explain why StringTemplate is a superb engine for doing code generation and why you should consider it if dealing with a code generation scenario. More… »

Choosing a Template Engine for code generation

Selecting a good Template Engine is an important issue when dealing with code generation.

Since 1998 I’ve been testing almost lots of them and forming an opinion about it at the same time the technology evolved. Been at CG2009 and attending the session of Kathleen Dollard on Template Specialization brought to my mind all the times I wasn’t satisfied with my current template engine and changed to try for a new one.

Doing commercial code generators, I’ve been tested lost of techniques: direct string concatenation, XSLT, direct code generation (or what Kathleen calls brute force code gen), ASP, JSP based approaches, developing custom template engines (two of them), taking a look to Code Smith, T4 and others, using NVelocity and finally arriving till StringTemplate (for the moment).
More… »