About

This blog is dedicated to comparison of Snippetory, a template engine for java, and the rest of the template engine world.The plan is to create a collection of implementations for Snippetory examples with other engines and to compare maintainability and maybe the performance of the implementations.

Snippetory is based on passive templates. I really think that passive templates as a whole are heavily underestimated in their potential to support in development of simply maintainable web applications and other template based approaches like code generation or simply sending e-mails.

While traditional script-based templates work pretty good in the complexity level, but only there, passive template based approaches provide a wide range of additional fields where the script-based templates not work.

The low complexity range even seems to be the niche of passive templates. Beneath java.text.MessageFormat there are countless home-brewed email frameworks. But the real power displays where the script-based approaches end on the upper side. Most obvious the separation of logic and template allows much more logic to be placed. As logic is implemented using a more fully featured language, inheritance and aggregation support in organizing the code and expressing structure.

Expressing structure

The lacking possibility to express structure created Tiles and Sidemesh as workarounds. Ok, in addition there are some solutions like Stringtemplate and Jangod. But these are heavy bricks optimized for this special task while passive template can achieve this easily, like javaBY Template Engine or JTPL. Where optimized for expressing structure means that each of them invests more code on inheritance than jByTE and JTPL for their complete implementation. Together.
How this works with Snippetory you can find here.

Massive Template re-use

To be able to re-use even small portions of template code it’s necessary to name and to fully parametrize these snippets. This only possible with a small number of engines like Stringtemplate, jByTE, JTPL, and Snippetory, of course.
The metaphor repository is an example for such an approach.