The Art of Creating A Top model
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:
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:
And this is really all there is to create an UML class diagram.















