Skip to content
jappy edited this page Oct 15, 2011 · 5 revisions

Table of Contents | Next - Embedding Tea

In general, neither developers nor page designers author Tea templates. The goal is that they be written and maintained by technical producers who are liaisons between developers and designers.

Tea resulted from several years of experience with other web page building mechanisms. Most web-based applications start out with HTML tags embedded in code, whether it be C, Perl, or Java. This approach is adequate for small or first-time projects because it doesn’t take very long to develop.

Because changes to page formatting can occur frequently, and developers don’t wish to make these changes, they inevitably evolve into using some kind of token replacement templating mechanism. Each token is just a placeholder for a string, which contains application-created data. These template systems further evolve into supporting special constructs for formatting tables, forms, and simple conditional logic.

When introducing programming constructs into a template, the challenge is to come up with something that is powerful enough, yet at the same time be simple and safe. If its too powerful, then complete applications could be developed in templates. If it is too weak, then HTML formatting ends up in the application. If it isn’t simple or safe, then application developers end up writing and maintaining templates.

Rather than embedding an existing language into something like an ASP or JSP, Tea is a language specially designed to meet the requirements of a templating system. It is safe, simple, efficient, and powerful.

In one instance, Tea is integrated with a special servlet. This servlet gives Tea templates control over page building, while retaining strong ties to a back-end application written by a Java developer. While this servlet provides functionality similar to that of JSPs, Tea enforces correct model-view separation because of the intentional language limitations. Although this is also the suggested separation model in JSPs, it cannot be enforced. In addition, Tea templates don’t support programming features that can be used irresponsibly. Modifications need not go through a strict review and testing phase, which would still be required for JSPs.

Everyone working on a project should be empowered to do their job the most effectively, and Tea does its part by letting you do exactly what you need, as easily as possible, and no more. Even on projects run by just developers, using Tea is still beneficial. It encourages good development practices and it makes applications easier to maintain.

Table of Contents | Next - Embedding Tea