views:

247

answers:

3

When designing a new object model I always start with the class diagram function in visual studio. Once I have drafted the first version, with a couple of tweaks based on gathering new info or a change in requirements I start working on the actual implementation.

As development gets busy and targets have to be met the diagram goes by the way side, then this ultimately ends in a different model to the one on designed from the outset.

How do you keep your class object model and code implementation in sync during the project life cycle ?

+1  A: 

If you want it to always be in sync you will have to generate it from the code itself.

Doesn't the class diagram provide this sort of functionality? I thought if you pointed it at existing classes it kept itself up to date.

Garry Shutler
I haven't really tried in VS2008, but in previous versions I always would get to a point where I have laid out the class "shapes", in proportion to the page. But once a classes attributes grow or a collection class is added it takes time to layout the shapes in the diagram - very time consuming.
Ferdeen
+1 for "If you want it to always be in sync you will have to generate it from the code itself." Back in the day, design was front-loaded, and it would get out of sync. Your best bet in today's world is to gen from code.
Don Branson
+1  A: 

I am a big fan of Enterprise Architect for architecture design.

You can start by designing your UML then it will generate the base code for you. Once you start developing and making changes in code it can take your code differences and sync them back to the model and vice versa.

It does a lot more, and there is also a plug-in for Visual Studio to make it pretty seamless.

There is a free trial if you want to check it out.

Dana Holt
Thanks for this. I have only tried the free class diagram stuff in Visual studio. I'll have a look at this, thanks.
Ferdeen
+1  A: 

You're experiencing the "design vs. reality" schism. When you plan the project, you won't know all the things you learn along the way. Therefore, the initial design will always be flawed.

My course of action is to have only a very crude design which specifies the main goals and leave breathing room for all the things which we will learn while we build the application. If I need a diagram, I always generate it from the living code because that's the only Truth(tm) which counts.

Aaron Digulla