Sunday, October 7, 2007

Code generators

I have often been asked "After all, what you provide is a code generator ?". Well, yes and no.

Yes, because every compiler is a code generator. Whether you generate assembly code, virtual machine instructions or source code doesn't make much a difference, as far as execution of the program is concerned.

No, because the words "code generator" convey the idea that the "true" source code is the generated code, not the one you wrote. If you have ever played with a code generator, you have certainly noticed how little support there is for your original source code. You have probably felt the need to patch the generated code, and you have probably complained about the lack of tool support (think about debugging) at the original source level.

At Ateji we're indeed generating source code, for one specific reason : generating source code enables the reuse of all legacy software engineering tools and techniques available in the Java ecosystem. It would actually have been easier to directy generate byte code for the JVM. But you never actually see the generated code : our languages extend Java or other mainstream general-purpose languages, so you won't ever need to patch the generated code. Our languages are integrated at the IDE level, so that you always work directly with the original source code that you wrote.

This is why we never use the word "code generator" when referring to our products : the generated source code does indeed exist, but is only an engineering artefact.