ZenArchitect.NL (Henk van Dijken)

the art of model-driven code generation

Archive for the ‘Uncategorized’ Category

The Pain Of Model-Driven Template-Based Code Generation Is In The Model

with 2 comments

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.

image

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!

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Written by Henk van Dijken

September 3rd, 2010 at 9:15 pm

Posted in Uncategorized