December 05, 2002

More on code generation

Ara brings up a discussion of code generation, which led me to the C2 wiki discussion of the topic. I wrote about code generation a couple months ago, using a snippet from our system as an example.

One point often overlooked about code generation is how agile you can be. Our system is fairly new for our slow moving industry -- it hasn't been used for 20 years -- and therefore has schema changes fairly frequently. Generating code allows us to respond to these change extremely quickly. You can do the same thing with reflection -- you can do anything with reflection! -- but IME systems based on reflection, particularly in a strongly typed language like Java, are very difficult to understand and debug. With code generation you have a concrete class you can open in your IDE, modify as needed to test out how it works and once it does, you can easily fold the changes back into the code generation system.

Next: Natural programming language
Previous: Sure, that money doesn't mean much...