Archive for the ‘Uncategorized’ Category
The Pain Of Model-Driven Template-Based Code Generation Is In The Model
Template-based code generation in fact is pretty easy. It very much resembles ordinary mail merge. You create some (sophisticated) template, fill in all the black holes with metadata from the model, and voila!
All code is generated automagically. A happy ending.
But no, often that is not the case. The pain is always in the model. Unfortunately, it is not rich enough in its metadata.
I love UML for communicating, but (natively) it is not rich enough for code generation. Did you ever tried to model a string that must have a length between 5 and 10? Not easy!
That’s why I mostly use a data model – or some slick derivative – as the data providing model.
The Entity Framework is a fine derivative. In fact, it is nothing more than a proprietary class diagram linked to the underlying data model. Microsoft, well done!















