Skip to content

Code generation - good or bad?

Despite the core instincts of many geeks, it is difficult to argue that the principle of code generation hasn't been effective. A compiler is a code generator, transforming a human (well, geek) understandable model to a CPU (or VM) understandable representation. The CS community has done that successfully for almost as long as it has existed.

The reason so many developers dislike code generation is that we associate it with generating geek understandable code from a model, and then mutating the result. Since we don't want to lose those mutations when we update our model, it requires a fully functional ARE (automatic roundtrip engineering) system.

This is actually different, in principle, from compiler-style code generation and has probably never been done successfully. Thus rationalizing the core instinct most geeks have to reject code generation. This was a big deal to me, since I hate following instincts that I can't rationally explain. Wee.