The Class Designer in Visual Studio: close to useless?

I really like the idea of having an embedded Class Designer in Visual Studio. It’s unfortunate that I can’t really use it effectively, though. I’ve been trying to use it every since it came out, but I often end up either going to Visio or just going to the whiteboard and drawing sketches manually.

There are just a few things I like about the VS Class Designer:

  • It looks fancy;
  • I don’t have to go anywhere else for a diagram.

That’s it.

As far as creating classes and its members, I think it’s much more productive to just do that in code (which is a lot faster if you’re using a tool such as CodeRush). So I really don’t see myself using the class diagram when I’m creating this stuff. If I’m trying to design something, I’ll just do it directly in a TDD style, or go to a whiteboard and sketch the simplest diagram I need in order to better understand what tests I need to write for my design.

There are more things I don’t like about the VS Class Designer:

  • Even though some people like the idea that the diagram gets updated from source code, I’m not sure that’s a good thing. Most often than not, I create diagrams that are as simple as possible, where I only include as many details needed to make the intent of the design as clear as possible. That means I carefully choose what members of a class I want to display.

    That said, I don’t want to add a property to a class in code and have it automatically added to the diagram (I may have added the property for implementation details and don’t want that cluttering the diagram). If it takes a lot of time from me to lay out a diagram, I may not want to add a property to a class and take the risk of that change messing up the layout of my pretty diagram. Well, that sucks (I want to make changes freely, and only change the diagram if I feel that the change is necessary to better explain the design).

  • Even though not directly related to the Class Diagram, I don’t like the fact that there’s no Sequence Diagram and State Diagram designers (two of the diagrams that are really helpful in explaining designs). I do understand that the diagrams in VS are not UML diagrams, but they do have lots of similarities, and it’d be good to have something like Sequence and State diagrams available.

Now to the thing that I hate the most about it:

  • There is no easy way to represent class relationships other than inheritance.

    Granted, inheritance is one of the pillars of OOP and must definitely be used wherever it makes sense. However, there are other things that may be deemed more appropriate to certain designs, such as the OOD principle "favor composition over inheritance". There’s just no way to represent composition in a way that makes sense. There’s a Power Tool for VS that adds a little support for composition, but that doesn’t work for me. If you add a composition relationship between two classes, the tool adds the arrow to the diagram pointing the two classes, but doesn’t show the reference as a property on the containing class. When you do that, it also adds code to your class that you may not want. For instance, if I have a class that has a property of a type that’s another class sitting there on the same diagram, the tool isn’t smart enough to draw the arrow for you, and if you try it yourself, it’ll add another property to hold the reference. Ouch.

     Diagram

  • There’s also no way to indicate that "this class uses that other class". One can add a "comment" to the diagram, but can’t really link it to any element on the diagram.

To overcome these problems I end up creating a part of the diagram in VS, and then using a tool such as MSPaint or Paint.NET to draw the other visual elements. What a shame.

Those are real deal breakers for me. Like I said, I keep trying to use the VS Class Diagram, but it’s been frustrating.  Diagrams are useful in some areas, but I certainly don’t want to become a slave for them, and when I do want to create a diagram, I want it to be ease to create and understand, and the current tool does not really give me that.

Advertisements
  1. #1 by Unknown on December 29, 2007 - 10:09 am

    Hi Claudio,Nice evaluation, the class designer certainly leaves much to be desired. I read that you like sequence diagrams to explain parts of a design? Me too :o)If you\’re looking for an editor that won\’t enslave you, check out this easy to use and smart UML sequence diagram editor I\’ve created.It isn\’t integrated into VS (to make matters worse : it\’s a java app – heresy! :o).. But I think you\’ll like it anyway, it is really quick, easy to use and it has a couple of neat features you won\’t find anywhere else.I\’m always happy to get feedback, let me know what you think of it!Best regards,Yanic

  2. #2 by Claudio on January 7, 2008 - 1:56 pm

    Hi Yanic,
     
    I\’ll check out your tool. Sounds promising. Rest assured I\’ll give you any feedback I may have.

  3. #3 by Al on March 25, 2012 - 11:05 pm

    I think it is as close to useless as it is possible to be. Visio is better but still terrible.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: