Advocating the high-end code generators

Recently, I watched two presentations on the Flex integration with the back-end applications. The presenters have shown how to build a database-enabled applications in – oh, well – 55 minutes. And they were using pre-built code and other “magic” tricks. In one case, an XML contained SQL that was interprted in the service. The presenter had a visual wizard to generate code. Both were very generic and dead simple.
That’s exactly what I did not like. Please don’t get me wrong. I like it simple. I am also big fan of things that work. Neither of this approaches works for me.

I am an old user of SQL tools that allow you to use SQL as a language, provide metrics, execution plans, use statistics, etc. A typical enterprise query can take seconds or hours – it is up to the programmer in most cases. As far as updates go, they never come by themselves. Transactions, workflow triggers and messaging are just a beginning.

You can try to wrap the generated code or service with additional assemblers. You loose development transparency as these are the wrappers for thing that are going to be re-generated. Additional management, build and fixing errors eats up all time saved by the code generation.

The second problem is with generics. I love to do more stuff with collections, arrays and lists. I also like Object and HashMaps – in some portions of the code. But strong typing provides performance, size and coding benefits that are hard to overlook.

I am guilty of building both types of code generators in the past. After using them for different industries and applications, I can say that their applicability is very limited: these code generators work for the low-end systems that have very limited use for them in the first place. For most of the systems you have to have a two-way tool, which allows you to write your own code in addition to the generated one.

The productivity environments that interpret back-end data are mixing SQL as first-class citizens with the application code. That is the only way to reach required flexibility. With compiled languages like Java it is not that simple. In order to achieve high performance and flexibility you need to mix the code but generate artifacts to work with SQL during the compilation stage. Java annotations (and SQL embedding for C++) are typical technologies that we use
The concept is very simple – you use abstract classes to mix your application code with the abstract methods for SQL code. This abstract methods are annotated with SQL. You can code against strongly typed classes and if the code generation fails, your compiler complains about abstract methods.

With the single point of maintenance we eliminate most of the integration/build issues. You can get the same 55 minutes application done in 5, but important point is that you will not be stuck for days afterwards.

If you have just five (not fifty five) minutes, please watch this pre-recorded demo of our code generator called Clear Data Builder.


Anatole Tartakovsky