I don't understand what the hollow diamond next to Class A together with the multiplicity next to Class B implies about the relationship between Class A and B. Could someone clarify this for me?
Asked
Active
Viewed 851 times
0

Geert Bellekens
- 12,788
- 2
- 23
- 50

Walter Park
- 1
- 1
-
4May be you could read some UML documentation? – mustaccio Mar 12 '16 at 04:27
1 Answers
2
- Aggregation is a special type of Association.
The lives of both objects are independent of each other.
Both objects have their own life cycle.
- Define the aggregation name.
- The direction of the empty diamond specifies which object contains the other object.
For an example,
For your question,
I don't understand what the hollow diamond next to Class A together with the multiplicity next to Class B implies about the relationship between Class A and B. Could someone clarify this for me?
What the multiplicity does is every Class A objects associated with zero to many Class B objects and also the Class B depends on Class A but they both have their own life cycles like the example that i gave unlike Composition
.
EDIT:
Like this ,
You have to specify in both sides whether how many objects involved with Class B objects.Like in 0..n in Class B side.

AVI
- 5,516
- 5
- 29
- 38
-
1Correct me if I am wrong: Class A is an aggregate class made up of zero to many constituent Class B objects? – Walter Park Mar 12 '16 at 04:22
-
-
Sorry. I edited my earlier comment. Please take a look at it again. – Walter Park Mar 12 '16 at 04:34
-
@WalterPark yes, but you have to note that in Class A to show that 1 or n number of objects connected with 0 or n number of objects of Class B – AVI Mar 12 '16 at 04:35
-
-
I do not understand what you are trying to say in "you have to note that in Class A to show that 1 or n number of objects connected with 0 or n number of objects of Class B." Could you please clarify. – Walter Park Mar 12 '16 at 04:42
-
-
Correct me if I am wrong: So in Class A you would have a field like **private Collection
** which would latter be initialized in it's constructor as a List or Set. Whereas in Class B you would have no field relating to Class A. – Walter Park Mar 12 '16 at 06:34 -
1@WalterPark: that is correct. A collection is one valid way to implement that multiplicity. However, note that in UML, the multiplicity is written as [0..*], or just [*]. It is never written with letters. – Jim L. Mar 12 '16 at 13:34