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

Reply via email to