about summary refs log tree commit diff
path: root/usth/ICT2.7/P2L2 OO Software Engineering and UML Subtitles/2 - Object Orientation Introduction - lang_en_vs5.srt
blob: 44fdd744132f692016bee733f7349bf707728a24 (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
1
00:00:00,390 --> 00:00:03,750
Let's start with a quick introduction to object orientation and

2
00:00:03,750 --> 00:00:07,920
the fundamental concepts behind it. And let's start by discussing what

3
00:00:07,920 --> 00:00:11,100
exactly is object orientation? If you're younger than me, it

4
00:00:11,100 --> 00:00:13,700
could be that the first programming language you learned was already

5
00:00:13,700 --> 00:00:17,030
an object-oriented language. But things were not always like this.

6
00:00:17,030 --> 00:00:20,660
Before object orientation became prevalent, people were not used to thinking

7
00:00:20,660 --> 00:00:23,447
in terms of objects. So what happened afterwards? And what does

8
00:00:23,447 --> 00:00:25,727
it mean to think in terms of objects and to follow

9
00:00:25,727 --> 00:00:28,583
an object-oriented approach? First of all, it

10
00:00:28,583 --> 00:00:32,203
means to give precedence of data over function.

11
00:00:32,203 --> 00:00:35,377
Did items rather than functionality become the center

12
00:00:35,377 --> 00:00:39,020
of development activities. This also allows for enforcing

13
00:00:39,020 --> 00:00:42,200
the very important concept of information hiding,

14
00:00:42,200 --> 00:00:45,460
which is the encapsulation and segregation of data

15
00:00:45,460 --> 00:00:49,710
behind well-defined and ideally stable interfaces. In order

16
00:00:49,710 --> 00:00:51,490
to be able to hide the design and

17
00:00:51,490 --> 00:00:54,130
also implementation decisions. And note that the terms

18
00:00:54,130 --> 00:00:58,580
encapsulation and information hiding are often used interchangeably, although

19
00:00:58,580 --> 00:01:01,270
some people prefer to think of information hiding

20
00:01:01,270 --> 00:01:04,709
as being the principle and encapsulation being the technique

21
00:01:04,709 --> 00:01:07,990
to achieve information hiding. The key concept though,

22
00:01:07,990 --> 00:01:10,110
no matter which term you use, is really to

23
00:01:10,110 --> 00:01:13,460
gather, to seclude this data behind sort of

24
00:01:13,460 --> 00:01:16,610
a wall and give access to the data only

25
00:01:16,610 --> 00:01:20,270
through interfaces that you, the developer define. And why is

26
00:01:20,270 --> 00:01:22,800
that important? Oh, for many reasons, and one of the main

27
00:01:22,800 --> 00:01:26,690
ones is that it makes code more maintainable. Because the

28
00:01:26,690 --> 00:01:28,860
rest of the code, the rest of the system doesn't have

29
00:01:28,860 --> 00:01:32,370
to be concerned on how the implementation details or the

30
00:01:32,370 --> 00:01:37,220
design are defined. And therefore, any change that happens behind this

31
00:01:37,220 --> 00:01:39,580
wall doesn't concern the rest of the system. And, doesn't

32
00:01:39,580 --> 00:01:41,820
affect the rest of the system, as long as you keep

33
00:01:41,820 --> 00:01:45,730
your interfaces consistent. Another advantage of focusing on

34
00:01:45,730 --> 00:01:49,230
objects and encapsulating the information into cohesive entities is

35
00:01:49,230 --> 00:01:52,130
that it allows the reuse of object definitions

36
00:01:52,130 --> 00:01:55,000
by incremental refinement. Which is what we normally call

37
00:01:55,000 --> 00:01:58,830
inheritance. And inheritance is definitely a fundamental concept

38
00:01:58,830 --> 00:02:01,560
in object orientation. For example, we can define a

39
00:02:01,560 --> 00:02:04,030
car as a refinement of the vehicle. That there's

40
00:02:04,030 --> 00:02:06,850
some additional characteristics with respect to a generic vehicle.

41
00:02:06,850 --> 00:02:11,220
And then we can use the car wherever a vehicle can be used, which is what we

42
00:02:11,220 --> 00:02:14,200
call polymorphism. And we'll continue this discussion for a

43
00:02:14,200 --> 00:02:16,440
very long time. Because there's so many things that

44
00:02:16,440 --> 00:02:18,860
could be discussed when we talk about object orientation,

45
00:02:18,860 --> 00:02:21,890
its characteristics and its advantages. But in the interest

46
00:02:21,890 --> 00:02:24,000
of time, let's for now just stop here. And

47
00:02:24,000 --> 00:02:27,020
start talking about two key concepts in object orientation.