I'm learning about UML, but I am confused about the concept of multiplicity. Consider the Customer
class and Order
class, in this diagram:
- First: which class does the number 1 belong to? what about the 0..*?
- Second: 1 on the line up, 0..* on the line down, Are there strict restrictions?
- Third: how to read the relation between
Customer
class andOrder
class?
The number
1
is a shortcut for1..1
, which means at least one and at most one, so in summary, exactly 1.In the context of your diagram, it means that that for every instance of
Order
on the other side, there is exactly 1 "associated"Customer
instance (the correct term should be "linked" since a link is to an association what an object is to a class).A multiplicity of
1..5
would mean at least 1 and at most 5.The
0..*
multiplicity, which can also be noted with the shortcut*
, means at least 0 (i.e there can be none) and no upper limit (i.e there can be a huge number of associated instances). So for everyCustomer
instance, there may be none, one, or many more linkedOrder
instances.This shall answer your first point, as well as your last point. You need to define "strict restrictions", as this is not an UML term.