11 Design Principles
11 Design Principles
1 2
Architectures/Framework
ITSS SOFTWARE DEVELOPMENT (Financial System, J2EE,…)
11. DESIGN PRINCIPLES OOD Patterns
OOD Principles
General + OO Concepts
1 2
3 4
1
30/9/2021
5 6
2
30/9/2021
9 10
11 12
3
30/9/2021
22
13 14
15 16
4
30/9/2021
17 18
19 20
19 20
5
30/9/2021
21 22
23 24
6
30/9/2021
25 26
25 26
27 28
27 28
7
30/9/2021
29 30
29 30
31 32
31 32
8
30/9/2021
33 34
Dependence Timer
Subclassing
TimeToStretch
33 34
36 37
TimeToStretch v3 Main v3
public class TimeToStretch extends TimerTask { • TimeToStretch tts = new TimeToStretch();
private Timer timer; Register interest with tts.start();
public TimeToStretch() { the timer • Use a callback to invert a dependency
timer = new Timer(this);
} • This diagram shows the inversion of the dependency
public void start() { Callback entry point between Timer and TimeToStretch (compared to v1)
timer.start();
Main does not depend on Timer
} TimeToStretch depends on Timer
Main
public void run() {
System.out.println("Stop typing!");
suggestExercise(); TimerTask Timer
}
...
} TimeToStretch
36 37
9
30/9/2021
38 39
38 39
40
40
10