locked
UML Class Diagrams and Feature Pack 2 RRS feed

Answers

  • Hi mscheaf,

    Thanks for the question.

    We don't currently create associations in the model or on the diagram for fields, because we found that for even relatively small classes which tended to have a few fields, dragging these onto the diagram would result in an overwhelming number of associations. This shouldn't be specific to code that includes generics -- both your examples above should not automatically create associations.  However, associations will be created in the model (and automatically placed on the diagram) for properties.  For the feature pack, we stuck with association rather than compositions or dependencies as we felt it was the best fit for how most people will create class diagrams.

    One thing being considered for a future release is an option to create associations automatically as part of the reverse engineering process; as part of that process I would expect we would also consider whether we would allow the user to specify which relationships to create.


    Matthew Cosner [MSFT] | Test Lead | Visual Studio Ultimate
    Wednesday, April 6, 2011 2:33 AM

All replies

  • OK I found a way to do it. With a blank uml diagram and architecture explorer open i can drag classes. But I have two issues. The associations aren't showing up for List<> of other classes. For example:

    Class ClassA{}

    Class ClassB

    {

    ClassA a;

    }

    The class diagram will show an association between those classes. But if I do:

    Class ClassB

    {

    List<ClassA> a;

    }

    No association will show on the diagram. Why is this?

    My other issue is that in the first example an association does show up. But shouldn't it be composition since classB contains a ClassA. I know in reality it only contains a reference, but as far as I know with .net it can only ever be a reference. I would still want the uml to show composition, because even though it is a reference is still is what makes up the class.

    Sunday, April 3, 2011 7:18 PM
  • Hi mscheaf,

    Thanks for the question.

    We don't currently create associations in the model or on the diagram for fields, because we found that for even relatively small classes which tended to have a few fields, dragging these onto the diagram would result in an overwhelming number of associations. This shouldn't be specific to code that includes generics -- both your examples above should not automatically create associations.  However, associations will be created in the model (and automatically placed on the diagram) for properties.  For the feature pack, we stuck with association rather than compositions or dependencies as we felt it was the best fit for how most people will create class diagrams.

    One thing being considered for a future release is an option to create associations automatically as part of the reverse engineering process; as part of that process I would expect we would also consider whether we would allow the user to specify which relationships to create.


    Matthew Cosner [MSFT] | Test Lead | Visual Studio Ultimate
    Wednesday, April 6, 2011 2:33 AM
  • "However, associations will be created in the model (and automatically placed on the diagram) for properties"

    Yeah I noticed that it only does the associations with properties, except it still doesn't do it for my example of List<ClassA>.

    "We don't currently create associations in the model or on the diagram for fields, because we found that for even relatively small classes which tended to have a few fields, dragging these onto the diagram would result in an overwhelming number of associations."

    Why not let us decide if there are too manyn associations or not, or even let us add and remove associations manually. That would have made more sense.

    "For the feature pack, we stuck with association rather than compositions or dependencies as we felt it was the best fit for how most people will create class diagrams."

    Then it's not true UML.

     

    Oh well, back to visio I guess.

    Wednesday, April 6, 2011 2:09 PM