about summary refs log tree commit diff
path: root/usth/ICT2.7/P4L5 Software Refactoring Subtitles/24 - Bad Smell Quiz Solution - lang_en_vs3.srt
blob: 27731163969d7b378c9de747858cffa868938300 (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
1
00:00:00,110 --> 00:00:03,090
So let's look at this one by one. The fact the program takes

2
00:00:03,090 --> 00:00:06,620
too long to execute is not really a bad smell. It probably indicates

3
00:00:06,620 --> 00:00:08,800
some problem with the code and the fact that we might need to

4
00:00:08,800 --> 00:00:11,420
modify the code to make it more efficient, but it's not something that

5
00:00:11,420 --> 00:00:14,030
we will normally classify it as a bad smell, so we're not going to

6
00:00:14,030 --> 00:00:17,850
mark it. The second one, conversely, is definitely a bad smell. The fact

7
00:00:17,850 --> 00:00:21,700
that the method is too long is a typical example of bad smell

8
00:00:21,700 --> 00:00:25,000
and one in which we might want to apply some refactoring, for example,

9
00:00:25,000 --> 00:00:26,450
the extract method or the

10
00:00:26,450 --> 00:00:29,240
decomposed conditional refactorings. There's definitely

11
00:00:29,240 --> 00:00:32,159
nothing wrong with the fact that the classes cat and dog

12
00:00:32,159 --> 00:00:35,600
are subclasses of class animal. Actually, that sounds pretty appropriate, so

13
00:00:35,600 --> 00:00:38,270
this is not a problem and definitely not a bad smell.

14
00:00:38,270 --> 00:00:40,990
Whereas the fact that every time we modify method M1,

15
00:00:40,990 --> 00:00:44,210
we also need to modify method some other method M2 as

16
00:00:44,210 --> 00:00:46,690
a typical example of bad smell. So this can actually be

17
00:00:46,690 --> 00:00:50,590
considered a specific example of what we just called "shotgun surgery."

18
00:00:50,590 --> 00:00:52,500
So it is a case in which we might want to

19
00:00:52,500 --> 00:00:55,750
use, for instance, the move method refactoring to fix the issue.