Professional Documents
Culture Documents
Duplicated Code:
If you see the same code
structure in more than one
place, find a way to unify
them.
http://www.industriallogic.com/blog/smells-to-refactorings-cheatsheet/
10
11
12
13
14
15
16
17
18
alternative designs
The move in the search space is achieved by
modeling refactorings (inheritance-related)
Apply search algorithms using QMOOD as the
fitness function (rank alternative designs)
The outcome is a sequence of refactorings
leading to the optimal design
SOEN 691C - Fall 2014
19
20
21
22
23
24
25
26
27
12 code smells
6 Professional developers were hired to
implement change requests
4 medium-sized Java systems with known
code smells
4 weeks of development
Daily interviews and think-aloud sessions
28
29
30
Advantages:
Feasible and behavior preserving solutions
to design problems
31
32
33
34
, = 1
SOEN 691C - Fall 2014
35
,
,
cohesion
coupling
36
37
Context
State
state
- state
int
type ::int
- STATE_A : int = 1
- STATE_B : int = 2
+ method() {
state.method();
if state == STATE_A
} doStateA();
else
if state == STATE_B
doStateB();
}
+method()
StateA
StateB
+method() {
+method() {
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
So far, we used
Static source code analysis
Semantic analysis
Change history analysis
59
60
61
62
63
64
65
Conflicts
Dependencies
SOEN 691C - Fall 2014
66
67