The virtues of different code generating techniques

One Star jim
One Star

The virtues of different code generating techniques

After exploring various Open Source ETL tools (CloverETL, KETTLE and Talend) I have come the conclusion that the Talend model is best. I like the strategy of generating the complete job in a standalone Java class. A great idea. There will be a lot of people wanting to develop components for Talend both for community usage and for use in individual projects. I see the use of JET as a an obstacle to that end. Using Java code to express a template to generate Java code makes building those templates a lot harder and more error prone (imho!). It is tough keeping track of what is template code and what is output code. Was templating tools like Velocity or FreeMarker considered? Is it technically feasible to replace JET with one of these other techniques? Is the code generation reasonably abstracted?
Thanks
Jim
Employee

Re: The virtues of different code generating techniques

I'm a member of the Perl dev team at Talend. I write components to generate Perl code. I must admit I was a bit disappointed by JET, I was finding it very complicated for doing simple things. As my templates don't generate Java code, I have less difficulties to see which parts of the template are Perl and which parts are Java, but I even have some, to be perfectly honest.
I'm sure mhirt will give you all JET advantages over Velocity.
Employee

Re: The virtues of different code generating techniques

Hi
Thank you for you Talend Evaluation.
We have choosed Jet after evaluating all Template tools. As Velocity and Freemarker are the main template tools, we have seriously evaluated them.
Velocity and Freemarker :
They are very Web application oriented. Even if these tools also provide mechanism for Code Generation, this is not their main goal.
When generating code with Velocity or Freemarker, you have to use a specifc syntax, nearly a new language. Developing a component is not very easy for beginners.
Jet
Jet is dedicated to Code Generation.
Jet uses Java and <% tags are very closed from a Jsp. This mechanism can be easily understood by a lot of users.
After template compilation, Code generation is faster (this is very important, we're regenerating code quite often in back-end to check user syntax).
A Jet Editor plugin exists for Eclipse.
Jet is an Eclipse Project and is very easy to integrate in an Eclipse RCP application like Talend.
plegall complains about Template development under vi-like tools. The problem would be exactly the same with all other Template frameworks and simple text editors.
It's true that using some other tools, like Eclipse with Jet Editor would be a good idea. In the future, we plan to develop a specific application to help users to develop their own components. First step is a place on talendforge.org, to share specific components. It will be open next week.
I hope I convinced you to try Jet Framework.
Best Regards
Mcihaël.
One Star jim
One Star

Re: The virtues of different code generating techniques

Thanks for the reply. I will check out the JET plugin for Eclipse. Colored syntax would go a long way in making the templates less complicated to read.
"When generating code with Velocity or Freemarker, you have to use a specifc syntax, nearly a new language."
That is the point exactly. Different language different syntax easily differentiated.
The other problem with the JET is also what brought about the existence of Velocity and FreeMarker. As sure as we sit here component builders will put into the code-generation phase things that have no business being there. Reading databases, accessing XML files or whatever they want good and bad. One of the drawbacks of JSP is that it lacks any control for the seperation of concerns. Business logic creeps into JSP views all the time making maintenance a nightmare. The limited syntax on template languages makes this very difficult to happen (not impossible!). The following website sums up this arguement pretty well: http://www.javalobby.org/java/forums/t54221.html
If you are not careful, components will be developed that do things during code-generation that take away control from TOS leaving the "tail wagging the dog".
As for the suitablility of "Web oriented" template technologies, take a look at the code generation in Hibernate. They use Velocity to generate all the java entity classes from the xml based Hiberate maps. Very complex yet very fast and reliable and embedded in Eclipse.
Great idea ... bright future!
Thanks
Jim