This was a presentation I gave earlier this month (October 2005) to the Atlanta C# Developer Group.
Code generation is one of those "cool" techniques in software development where you just don't know what you have been missing until you see it in action... and then once exposed to it, you find yourself wondering "how did I ever get along without this?".
In this presentation, I discussed the reasons and benefits of using code generation tools, and the problems they can solve (or avoid entirely). I focused on the benefits of consistent code, building upon a solid foundation, and simplification of complex application features.
We designed and built the code for a basic application foundation, supporting simple features such as lightweight enforced transactions, entity persistence, and other baseline features. Then a series of linked templates were created that take advantage of that code foundation. Finally, we built an example UI that leverages the generated middleware to dramatically simplify and streamline the actual development process. It was pretty durn cool IMO.
All templates were built using CodeSmith, which is a fantastically useful tool. I feel like I might have been giving a sales pitch for that product by showing off many of the way too cool features of the new version of CodeSmith, but it's one of those things I strongly feel is worth every penny.
The powerpoint slide deck and all relevant source code can be downloaded from the presentation archive of the Atlanta C# Developer's Group website at: http://www.atlantacsharp.org/PresentationArchive.aspx