|
1 | 1 | package me.premaseem;
|
2 | 2 |
|
| 3 | +import me.premaseem.remotes.MasterRemoteFacade; |
3 | 4 | import me.premaseem.remotes.SetTopBoxRemote;
|
4 | 5 | import me.premaseem.remotes.SoundSystemRemote;
|
5 | 6 | import me.premaseem.remotes.TVRemote;
|
@@ -13,19 +14,21 @@ public class Client {
|
13 | 14 | public static void main (String[] args) {
|
14 | 15 | System.out.println("Master Remote Facade ");
|
15 | 16 |
|
16 |
| -// Client is tightly coupled with sub systems |
17 |
| -TVRemote tvRemote = new TVRemote(); |
18 |
| -SoundSystemRemote soundSystemRemote = new SoundSystemRemote(); |
19 |
| -SetTopBoxRemote setTopBoxRemote = new SetTopBoxRemote(); |
| 17 | +// decoupled systems from client and moved to facade |
| 18 | +MasterRemoteFacade masterRemoteFacade = new MasterRemoteFacade(); |
20 | 19 |
|
21 |
| -// Turning ON requires several calls |
22 |
| -tvRemote.trunOn(); |
23 |
| -soundSystemRemote.trunOn(); |
24 |
| -setTopBoxRemote.trunOn(); |
| 20 | +// Facade simplified code and reduced complexity |
| 21 | +masterRemoteFacade.turnOn(); |
| 22 | +masterRemoteFacade.turnOFF(); |
25 | 23 |
|
26 |
| -// Turning OFF requires several calls |
27 |
| -tvRemote.trunOn(); |
28 |
| -soundSystemRemote.trunOn(); |
29 |
| -setTopBoxRemote.trunOn(); |
| 24 | +// // Turning ON requires several calls |
| 25 | +// tvRemote.trunOn(); |
| 26 | +// soundSystemRemote.trunOn(); |
| 27 | +// setTopBoxRemote.trunOn(); |
| 28 | +// |
| 29 | +// // Turning OFF requires several calls |
| 30 | +// tvRemote.trunOn(); |
| 31 | +// soundSystemRemote.trunOn(); |
| 32 | +// setTopBoxRemote.trunOn(); |
30 | 33 | }
|
31 | 34 | }
|
0 commit comments