The Model Driven Software Network

Raise your level of abstraction

StringTemplate: a great template engine for code generation

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.

As commented before in other post, I felt in love with StringTemplate in 2005 when I discovered ANTLR and StringTemplate during the development of a MDD workbench for a customer. Prior to that date, I had tested many template engines and also developed on my own a pair of them. For one reason or another, I was not comfortable with the language, the coupling of the template with the transformation control, or the maintainability of the templates in the long term. As the time goes by, this last point arises as crucial to maintain and evolve your architecture.

Therefore, one could say that I am being quite loyal to StringTemplate for the last 5 years, and that too much for technology, moreover, for a product software. And such loyalty is definitely not my merit for not been promiscuous in this issue, but a merit of StringTemplate: I’m still looking for new ways for improvement and didn’t find one better to my needs. (Note: this is probably the best compliment I never paid to a piece of good software.)

Some products shine thanks to the many features they provides, StringTemplate sparkles for avoiding adding features in the wrong place. I will elaborate a bit more on that.

If you like to know more about it, follow reading at The Metalevel.

Views: 153

Add a Comment

You need to be a member of The Model Driven Software Network to add comments!

Join The Model Driven Software Network



© 2019   Created by Mark Dalgarno.   Powered by

Badges  |  Report an Issue  |  Terms of Service