Code Generation: Another Justification


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.



Shawn
Shawn Wildermuth
Author, Teacher, and Coach




My Courses

Wilder Minds Training
Vue.js by Example (New Lower Price)
Bootstrap 4 by Example (New Lower Price)
Intro to Font Awesome 5 (Free Course)
Pluralsight
Building an API with ASP.NET Core (New Course)
Building a Web App with ASP.NET Core, MVC6, EF Core, Bootstrap and Angular (updated for 2.2)
Less: Getting Started (New)
Using Visual Studio Code for ASP.NET Core Projects
Implementing ASP.NET Web API

Application Name WilderBlog Environment Name Production
Application Ver v4.0.30319 Runtime Framework x86
App Path D:\home\site\wwwroot\ Runtime Version .NET Core 4.6.27514.02
Operating System Microsoft Windows 10.0.14393 Runtime Arch X86