about summary refs log tree commit diff
path: root/usth/ICT2.7/P2L2 OO Software Engineering and UML Subtitles/20 - Class Diagram: Association & Aggregation Relationships - lang_en_vs5.srt
blob: 87709285be432b141a61489b42f7093ea02d6f96 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
1
00:00:00,080 --> 00:00:02,469
The next example of relationship we're going to look at is

2
00:00:02,469 --> 00:00:06,740
the association relationship. This is a relationship in which objects of

3
00:00:06,740 --> 00:00:09,570
one class are connected to objects of another. And it's

4
00:00:09,570 --> 00:00:12,480
called an has a relationship. So it means that objects of

5
00:00:12,480 --> 00:00:15,930
one class have objects of another class. So let's see

6
00:00:15,930 --> 00:00:18,750
what that means. Let's do it by considering two classes in

7
00:00:18,750 --> 00:00:22,370
our example system. The student class and the course offering class.

8
00:00:22,370 --> 00:00:25,300
In this case, there is an association between the student and

9
00:00:25,300 --> 00:00:28,010
the course offering, because the student is registering for the

10
00:00:28,010 --> 00:00:31,750
course offering. So, in a sense, the course offering has students.

11
00:00:31,750 --> 00:00:35,360
Contains students, to indicate this fact we add a solid

12
00:00:35,360 --> 00:00:38,750
line between the student class and the course offering. And the

13
00:00:38,750 --> 00:00:40,540
fact that having a solid line doesn't really tell us

14
00:00:40,540 --> 00:00:44,780
much about the nature of the relationship, so to clarify such

15
00:00:44,780 --> 00:00:47,550
nature we can use what we call adornments that we

16
00:00:47,550 --> 00:00:51,010
can apply to associations we can add to associations to clarify

17
00:00:51,010 --> 00:00:53,850
their meaning. In particular we can add a label to

18
00:00:53,850 --> 00:00:57,550
an association and the label describes the nature of the relationship.

19
00:00:57,550 --> 00:01:00,440
In this case, for example, it clarifies that the student

20
00:01:00,440 --> 00:01:03,970
registers for CourseOffering. We can also add a triangle to

21
00:01:03,970 --> 00:01:07,050
further clarify the direction of the relationship. So in this

22
00:01:07,050 --> 00:01:10,240
case, the triangle will indicate that it's the student That registers

23
00:01:10,240 --> 00:01:13,120
for the course offering, and not the other way around. Another

24
00:01:13,120 --> 00:01:16,650
important adornment or limitation that we can put on an association,

25
00:01:16,650 --> 00:01:20,800
is multiplicity. Multiplicity defines the number of instances of one

26
00:01:20,800 --> 00:01:23,540
class that are related to one instance of the other

27
00:01:23,540 --> 00:01:26,900
class. We can define multiplicity at either end of the

28
00:01:26,900 --> 00:01:29,620
relationship. In this case, for instance, we can say that

29
00:01:29,620 --> 00:01:31,890
if we look at the student, the student can register

30
00:01:31,890 --> 00:01:35,410
for two or more course offerings. Whereas, if we look

31
00:01:35,410 --> 00:01:37,560
at the course offering, we can say that each course

32
00:01:37,560 --> 00:01:42,260
offering can have or can enroll between 1 and 50 students.

33
00:01:42,260 --> 00:01:45,120
So as you can see by adding a label, a direction,

34
00:01:45,120 --> 00:01:49,590
and multiplicity, we make it much clearer what the relationship is

35
00:01:49,590 --> 00:01:52,170
and what it means and what are its characteristics. As we

36
00:01:52,170 --> 00:01:55,130
saw when we introduced relationships, there is a different kind of

37
00:01:55,130 --> 00:01:58,860
association, kind of a specialized one, which we call aggregation. So

38
00:01:58,860 --> 00:02:01,130
here we're going to look at an example of an aggregation. So

39
00:02:01,130 --> 00:02:03,490
first of all what is an aggregation? An aggregation is a

40
00:02:03,490 --> 00:02:07,580
relationship between 2 classes in which 1 represents a larger class

41
00:02:07,580 --> 00:02:10,610
like a whole which consists of smaller classes which are

42
00:02:10,610 --> 00:02:13,430
the parts of this whole. So lets look at an example

43
00:02:13,430 --> 00:02:16,960
in the context of our system. Let's consider a Course

44
00:02:16,960 --> 00:02:19,160
and the CourseOffering. And in this case, we can see

45
00:02:19,160 --> 00:02:23,000
that the Course consists of multiple CourseOfferings. So in

46
00:02:23,000 --> 00:02:26,520
a sense, a course is a whole and the course offerings

47
00:02:26,520 --> 00:02:29,430
are the parts of this whole. So this a perfect case

48
00:02:29,430 --> 00:02:32,620
in which we will use an aggregation to express this relationship.

49
00:02:32,620 --> 00:02:37,630
So we will add a solid line with a diamond on the side of the whole class

50
00:02:37,630 --> 00:02:42,380
to indicate that the course consists of multiple course offerings.

51
00:02:42,380 --> 00:02:44,670
And as we did for associations even though we

52
00:02:44,670 --> 00:02:46,010
are not going to do it for this specific

53
00:02:46,010 --> 00:02:49,540
example, we could also in this case add multiplicity

54
00:02:49,540 --> 00:02:52,830
information on the aggregation to indicate how many classes

55
00:02:52,830 --> 00:02:55,310
of the two types are involved in the relationships.