Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Aggregation multiplicity UML

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 !

like image 798
DKF Avatar asked Dec 18 '12 14:12

DKF


2 Answers

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

like image 175
Darren Avatar answered Nov 09 '22 19:11

Darren


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.

like image 33
SomeWittyUsername Avatar answered Nov 09 '22 19:11

SomeWittyUsername