ZenArchitect.NL (Henk van Dijken)

the art of model-driven code generation

The Art of Creating A Top model

without comments

If you want to master the art of model-driven code generation, an essential thing you need is a model of some kind. Maybe you are in desperate need of Kate Moss, but that’s not the kind of model I talking about. I mean some kind of data model.

Preferably, you describe your model in UML. But that is not essential.

As far as I am concerned, you can write it down in notepad, if you like.

My model contains students. Students are member of a certain class, for example a class named Class 3a. A typical class consists of many students, but a student can only be part of one class. The students attend many different courses and a course can have many students.

This data model translates to database tables and relations. In this case you have a table Student, Class and Course. Student has a 1-to-many relationship with Class and a many-to-many relationship with Course.

If you created this database and then extracted a database model from the database, it would look like this:

class-student-course DBS

This would be a physical data model. A drawback of a physical model is that there is no proper way to show a many-to-many relationship. A join table StudentCourse is needed to show such a relationship. In fact it is a pattern to create a many-to-many join in a table.

In UML it looks like this:

class-student-course UML

And this is really all there is to create an UML class diagram.

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

July 15th, 2009 at 8:17 pm

Leave a Reply