Stringly typed templates use String literals to access data structures. Top-level data structures are typically passed from Java code to the template processor as key-value pairs in a Map.
The first problem is run-time errors caused by human error. Developers can introduce bugs by:
These kinds of errors can only be found at run-time. Hopefully this happens during automated or manual testing rather than in production. The strong typing used in bLight templates eliminates this risk by having the Java compiler pick up these kinds of errors. Invalid templates will not compile, and therefore cannot be deployed.
The second problem with Stringly typed templates is decreased developer productivity due to inadequate tool support. bLight templates offer the following advantages in Modern IDEs:
bLight supports generation of any text output format, such as plain text, HTML, XML, email, etc. It is simple to extend AbstractTemplate to add output-specific productivity methods.
Yes - see AbstractTemplate.include(AbstractTemplate).
How far you should go depends on your personal preference. For example, developers coming from a web-development background may find it easier to visualise page structure if it is written in HTML rather than a collection of method calls. Common site header/footer templates are probably a good start.
bLight does not directly support i18n, but the bLight AbstractTemplate is designed to be sub-classed
to add application-specific utility methods. For example, create an i18n utility method and replace:
/*<h1>Welcome</h1>*/
with:
/*<h1>*/i18n(AppMessages.WELCOME);/*</h1>*/.
Not necessarily, but it is easier to fall into this trap than in other templating languages. Other templating languages do still allow template mark-up to call Java code (other than the model beans), but developers usually have to go out of their way to enable this. Peer reviews are recommended for junior developers to encourage good development practices.