about summary refs log tree commit diff
path: root/usth/ICT2.7/P2L2 OO Software Engineering and UML Subtitles/13 - Class Diagram: Class - lang_en_vs5.srt
blob: b02e6ea89af5827efc42c3a0bd6f35bdf4195ec2 (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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
1
00:00:00,120 --> 00:00:02,370
So how do we represent a class in a class

2
00:00:02,370 --> 00:00:06,140
diagram? Class is represented as a rectangle with three parts. The

3
00:00:06,140 --> 00:00:09,290
first part is the class name. Classes should be named using

4
00:00:09,290 --> 00:00:12,160
the vocabulary of the domain, so we should pick names that

5
00:00:12,160 --> 00:00:16,059
make sense. And the normal naming standard requires that the classes

6
00:00:16,059 --> 00:00:19,720
are singular nouns starting with a capital letter. The second part

7
00:00:19,720 --> 00:00:22,840
of the class are the attributes of the class, where the

8
00:00:22,840 --> 00:00:25,310
set of attribute for the class, we find the state for

9
00:00:25,310 --> 00:00:27,940
the class. And, we can list an attribute simply by

10
00:00:27,940 --> 00:00:31,060
name, or we can provide the additional information. For example,

11
00:00:31,060 --> 00:00:33,520
we might define the title of the attribute, and we

12
00:00:33,520 --> 00:00:37,450
might also define the initial. Value for the attribute. Finally, the

13
00:00:37,450 --> 00:00:40,850
third part of the class consist of the operations of

14
00:00:40,850 --> 00:00:44,050
the class. And normally, the operations of the class are represented

15
00:00:44,050 --> 00:00:47,090
by name, with a list of arguments. That the operation

16
00:00:47,090 --> 00:00:50,340
will take as input, and with a result type. So the

17
00:00:50,340 --> 00:00:53,750
type of the result produced by the operation. Something

18
00:00:53,750 --> 00:00:55,940
else you can notice in this representation is the

19
00:00:55,940 --> 00:00:58,450
fact that there is a minus before these attributes

20
00:00:58,450 --> 00:01:01,810
and a plus before this operation. This indicates what is

21
00:01:01,810 --> 00:01:04,739
called the visibility of these class members. So the

22
00:01:04,739 --> 00:01:08,950
minus indicates that the attributes are private to the class.

23
00:01:08,950 --> 00:01:12,600
So only instances of this class, roughly speaking, can

24
00:01:12,600 --> 00:01:15,340
access these attributes. And notice that this is what allows

25
00:01:15,340 --> 00:01:19,030
to enforce the information hiding principle, because clients of

26
00:01:19,030 --> 00:01:22,000
the class cannot see what's inside this box, what are

27
00:01:22,000 --> 00:01:25,360
these attributes. The plus conversely indicates that this is a

28
00:01:25,360 --> 00:01:28,850
public operation. So something that is visible outside the class.

29
00:01:28,850 --> 00:01:30,790
And, in fact, normally, this is what we use to

30
00:01:30,790 --> 00:01:35,110
define the interface for my class. So we encapsulate the

31
00:01:35,110 --> 00:01:37,730
state of the class and we make it accessible to

32
00:01:37,730 --> 00:01:40,370
the extent that we want and that is needed through

33
00:01:40,370 --> 00:01:43,850
a set of public operations. Last thing I want to

34
00:01:43,850 --> 00:01:46,730
note is the use of these ellipses that we can

35
00:01:46,730 --> 00:01:49,520
utilize if we want to indicate that there are more

36
00:01:49,520 --> 00:01:52,400
attributes for example, or more operations. But we just don't

37
00:01:52,400 --> 00:01:55,160
want to list them now. Okay now that we know what

38
00:01:55,160 --> 00:01:58,020
a class is, and how it is represented, let's start

39
00:01:58,020 --> 00:02:02,150
our analysis of our course management system. By identifying the

40
00:02:02,150 --> 00:02:05,530
relevant classes in the system, we need to bring back the

41
00:02:05,530 --> 00:02:08,270
description of our system. And what we want to

42
00:02:08,270 --> 00:02:10,389
do, is that we want to go through the description

43
00:02:10,389 --> 00:02:14,840
and underline the relevant nouns in the description. And here

44
00:02:14,840 --> 00:02:17,020
I encourage you to stop the video and to do

45
00:02:17,020 --> 00:02:20,450
the exercise of underlying such nouns yourself before listening to

46
00:02:20,450 --> 00:02:23,910
my explanation into how I do it. For example in

47
00:02:23,910 --> 00:02:28,030
this case I might want to underlined the registration manager which

48
00:02:28,030 --> 00:02:30,820
is a noun and probably a relevant one. The scheduling

49
00:02:30,820 --> 00:02:33,800
algorithm, also seems like a relevant concept, so

50
00:02:33,800 --> 00:02:37,890
is the course. The course offerings, again, course offerings

51
00:02:37,890 --> 00:02:40,930
over here. Definitely, the students seem to be a

52
00:02:40,930 --> 00:02:44,750
relevant noun and so is probably the registration form

53
00:02:44,750 --> 00:02:47,140
and the professors. Okay, so, at this point, I

54
00:02:47,140 --> 00:02:50,630
identified seven possible classes for my system. So, what

55
00:02:50,630 --> 00:02:53,340
I'm going to do is simply to create classes for

56
00:02:53,340 --> 00:02:55,980
each one of these nouns. So my initial class

57
00:02:55,980 --> 00:03:00,100
diagram looks exactly like this, with the seven classes where

58
00:03:00,100 --> 00:03:03,140
for each class, I picked the name that is representative of

59
00:03:03,140 --> 00:03:05,680
the domain. So, in this case, it's pretty straightforward. The

60
00:03:05,680 --> 00:03:08,950
registration form is called registration form, the student is called student

61
00:03:08,950 --> 00:03:10,780
and so on and so forth. But you can already

62
00:03:10,780 --> 00:03:14,490
see how this analysis method is starting from a description of

63
00:03:14,490 --> 00:03:17,950
the real world and it's just identifying objects or classes

64
00:03:17,950 --> 00:03:21,240
in the real world and transforming them into entities in my

65
00:03:21,240 --> 00:03:22,260
analysis document.