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.
|Using Visual Studio Code for ASP.NET Core Projects (new)|
|Building a Web App with ASP.NET Core, MVC6, EF Core and AngularJS|
|Building a Web App with ASP.NET5, MVC6, EF7, and AngularJS (Retired)|
|Best Practices in ASP.NET: Entities, Validation, and View Models|
|Front-End Web Development Quick Start|
|Lessons from Real World .NET Code Reviews|
|Node.js for .NET Developers|
|Application Name||WilderBlog||Environment Name||Production|
|Application Ver||18.104.22.168||Runtime Framework||.NETCoreApp,Version=v1.1|
|App Path||D:\home\site\wwwroot||Runtime Version||.NET Core 4.6.25211.01|
|Operating System||Microsoft Windows 6.2.9200||Runtime Arch||X86|