Wednesday, January 14, 2004

J2EE: Code Generation Techniques

I have been ruminating on the complexity of developing Websphere/J2EE applications. N-tier layered applications are fab and groovy but tend to have what appears to be repeating elements through the layers and into the database backend.

This kind of approach is neccessary to reap the benefits of the MVC pattern etc but from a manual coding/maintenance point of view, looks like a load of Sandra Bullocks to me.

Well you don't have to type all this stuff in you could use a code generator of course. The ServerSide article "Back End Code Generation Techniques For Java" describes these tools rather nicely.

It is full of sobering little nuggets like:

"There are a number of persistence options, and some options, like EJB, take up to seven classes and interfaces per database table. It’s no great wonder that of the 150 tools listed in the Code Generation Network database that the majority are for Java, and that the majority of those are for building database persistence code."

The article goes on to list a number of code generation approaches and tools; some of them open source. The most interesting approach for me was the the roll you own, using XSLT. He doesn't mention Rational Rose though, but I guess that is another beastie altogether.

Thing is, if I am honest, I can't stand code generators. They tend to churn out a load of chaff saying "This function was generated by CheeseWare Incs Cheese-o-matic 2004" and then you go and re-write most of it.

Rock and a hard place m'thinks.

This page is powered by Blogger. Isn't yours?