Only have experience with Velocity of those listed so can't comment on the others, but wouldn't it make sense to "eat your own dogfood" (keep it in the Apache family), unless of course one of the others were that much more superior. At first glance, looks like they are mostly older and less active projects though.
IMHO: Templating Engines generally mean more modularity, in exchanged for high code dependency on the library used. It's also another point of failure. As long as it was designed so that using the chosen Template Engine was an *optional* feature, rather than requiring all widget models to pass data through the template or support it, that would probably be a good idea. I think the goal is to keep the Widgets themselves and their logic as simple as possible (even goes for the XML and Atom/JSON representations). Especially if the Template Engine was able to be activated or deactivated through XML config, build properties or the like, that makes it lower risk for organizations adopting Wookie as their Widget container framework. (But that probably comes with even more coding and may or may not be possible depending on the Template Engine, so I shouldn't talk) Speaking of simple widgets, what is the process for submitting a sample widget? I've got a couple useful pure-AJAX examples that pull data from Web Services cross-domain without requiring a Proxy... let me know if you'd like to include them, Bryan -----Original Message----- From: Scott Wilson [mailto:[email protected]] Sent: April 30, 2010 10:25 AM To: wookie-dev Subject: Should we use a templating engine for API views? Hi everyone, Just looking over the various classes in the org.apache.wookie.helpers package I was wondering if we should be replacing the various methods like "toXml()" and "toJSON() in WidgetHelper, WidgetInstanceHelper (etc) with a templating engine to generate the various representations of classes we expose in the API. Looking over the API we have 6 classes to represent using XML, and also potentially in JSON and Atom (at least in the case of Widget), so around 13 templates. I've had a brief look at a few OSS templating engines: Apache Velocity (http://velocity.apache.org/) Tea (http://teatrove.sourceforge.net/) FreeMarker (http://freemarker.sourceforge.net/) There is a list of others here: http://java-source.net/open-source/template-engines I think the "pros" for using templating engines are: - templating languages are easier to work with than Java code, - implementers can edit templates directly without touching the source (e.g. to remove or include properties, or use different markup, etc.) - formatting code is removed from the java source (no more clumsy string building) The "cons" are: - it adds more dependencies - it will take effort to do What do you think? Any experience in using these? Do you think its worth the effort? S
