Rants and Raves

Thanks for visiting my blog!

Code Generation: Another Justification
Code Generation: Another Justification
December 27, 2024

Url: http://sellsbrothers.com/news/showTopic.aspx?ix…

I recently read about the reemergence of Code Generation on Chris Sells’ News page. It seems that John Lam has been converted, but not by Chris. As some may know, I worked with Chris Sells while he lead the team that built DevelopMentor’s Gen<X> so that I have been thinking about this code generation question quite a long time now.

Recently, topic open up on the Windows Technical: Off
Topic
mailing list. It seems that Shawn Van Ness (also a Gen<X> alum) has been beating the Code Generation drum lately. In fact he has a pretty cool .NET port of the X-Code engine (the heart of Gen<X>).

The question always seems to come about what is the compelling reason to use Code Generation in development. I’ve been in Chris Sells’ camp that allowing to reuse domain knowledge by creating exemplars. For the last ten months I have been working on a metadata driven system for OneSource Information Services. This is where I had my epiphany. The trouble we have been having is getting the performance of a completely metadata driven system high enough to be acceptable. That’s when it happened…I realized that if we allowed our system to be metadata driven at
compile time
, we could achieve the performance.

While at DevelopMentor, we did this very thing. We had a file format that was based on an XSD. Using an XML DOM could have allowed us to do everything we wanted, but why? Chris Tavares generated a wrapper class based on the XSD at every compile. This worked great.

So this is my stake in the ground. Using Code Generators to create code that is based on metadata to help make a performant, but flexible system. Anyone else use code generation in this way? If so, please let me know. I want to confirm my suspicion.