UML Tip : Showing Multiplicity in a Class

Sometimes UML diagrams get too big. You want to show all the important relationships, but everything is starting to look like a big mess.

In UML it is possible to represent multiplicity in a class. Say I have a Patient, and this patient has many addresses, like thus :

In UML you can represent the relationship with multiplicity inside the class like thus :

This saves on space in the diagram assuming you really want to show this relationship (and not just leave it out altogether). Obviously the internals of the Address class do no exist here, but depending on what you are trying to communicate in the diagram, these details may not be important anyway.


Posted in UML | Tagged , , , | 1 Comment

One Response to UML Tip : Showing Multiplicity in a Class

  1. matty says:

    Please look at the attached diagram.
    http://imageshack.us/a/img84/5544/dia1hj.png

    Assume we have 1 customer with:
    a) 1 permanent address and same mailing address
    or
    b) 1 permanent address and 1 other mailing address.

    So a) is 1 customer object and 1 address object, b) is 1 customer object and 2 address objects.

    And it works good with defined multiplicity.
    But when viewed from the address side I don’t want to have 1 address object assigned with 2 customer objects. Now it is possible – look at the attached object diagram – but I don’t want it to be allowed:
    http://imageshack.us/a/img189/4900/dia2f.png

    Can you provide any solution to this? I don’t know any solution, I thought about {xor}, but it doesn’t work like I wanted.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

THREE_COLUMN_PAGE