attributesumlassociationsclass-diagrammultiplicity

Class diagram - showing multiplicity twice (association and in attribute)?


Having a class Customer that has a list of up to 10 Orders:

Customer
--------
+orders:Order[0..10]

But that means Customer is associated with Order class via aggregation, also:

Customer                                          Order
--------                <>------------------->    --------
+orders:Order[0..10]

Should I also indicate 0-10 in the class association? Because I saw many diagrams do but on the other hand, this is specified in the attribute of Customer.


Solution

  • In fact you have to choose how you want to show the fact that a customer has a list of up to 10 Orders. You can depict it as an attribute or an aggregation or both but this latest option could be confusing. In all case if you want to model that as association (or composition or aggreagation) you have to show the multiplicity otherwise it would not be clear...

    For more information take look a the 9.5.3 section of UML 2.5 specification