3

I am creating UML diagrams that will represent C# code and I've reached somewhat of an impasse. I am currently representing a Dictionary<object, object> by using a qualified association, where the qualification is the key type and the class at the end of the association is the value type.

Now I would like to represent a type in UML, like so: Dictionary<int, Dictionary<object, object>. Is there any type of standard I can use to create a relationship that will accurately represent this relationship?

Spencer
  • 306
  • 1
  • 14
  • Possible duplicate of [How can I represent a Python dictionary in UML?](https://stackoverflow.com/questions/29912096/how-can-i-represent-a-python-dictionary-in-uml) Although it's for Python, the principle should be the same. – qwerty_so Jul 20 '17 at 14:17
  • I did find that one and it did help me with representing a singular`Dictionary` object. The problem I am having is I cannot find an explanation for nested `Dictionary` objects. As in, a `Dictionary` within a `Dictionary`. – Spencer Jul 20 '17 at 15:34
  • @Peter Oh, I didn't realize an association could have two qualifiers. That's perfect. Thank you very much! Did you want to add this as an answer so I can accept it? – Spencer Jul 20 '17 at 17:03
  • @SpencerElliott sorry I spoke too soon; you can have multiple qualifiers, but the meaning of it is a bit different. I will try to write a more complete answer soon. – Peter Uhnak Jul 20 '17 at 18:50
  • 1
    @SpencerElliott speaking of which, could you be a more specific about the context of your problem -- e.g. an actual example instead of just a generic `Dict>`, because there are different ways how to approach that -- also it is not clear what the "user" actually owns in the relationships. – Peter Uhnak Jul 20 '17 at 19:06

1 Answers1

1

That line with angle brackets is merely a declaration that says what relations the class will have. You cannot show the declaration in the UML, except in a note (also useful it can be). But you can (and you should) show the relations themselves. Practically, the line Dictionary<int, Dictionary<object, object> can be taken as a strict declaration of a simple class diagram.

enter image description here

Gangnus
  • 24,044
  • 16
  • 90
  • 149