Me and my colleagues can't agree on a point. In UML, when an aggregation is made, does the diamond shape side have a multiplicity of 1 maximum, or can it be 0..* ? Or is it depending of a point of view ?
Thank you in advance !
Firstly, you need to be specific about which 'diamond' you mean as a empty diamond in aggregation and a filled diamond is composition?
If you mean empty diamond then Icepack is correct, and you are confusing 2 separate things. Multiplicity is not related to Aggregation so a 'diamond shaped' aggregation indicator can have any multiplicity you like as they are unrelated.
If you mean filled diamond ie composition then the example someone has posted won't really help you as it's saying: "There are many departments but only 1
University (multiplicity)" and that "if all departments are deleted then University is also deleted (composition)".
I am struggling to think of a good example where composition end wouldn't be 1 only
and as far as I can think it would never be 0..*
as you can have a class which has to delete something which may not ever exist? I could however be 1..*
ie many to many, for example Exam and Exam Questions.
The multiplicity may be 1..*
to 1..*
ie exam have 1 or more
question and a question can reside in 1 or more
exams. Filled diamond (composition) at Exam end would mean that if all questions were deleted then all exams would be deleted too
Yes, it can be 0..*. There is a good example here: Department has several professors and each professor may belong to several departments at the same time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With