Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Facade design pattern - Before code (POOR code)
  • Loading branch information
premaseem committed Feb 19, 2018
commit 27c11fe78603a971b7aadc47565279f7586afaa6
13 changes: 0 additions & 13 deletions pattern/src/com/premaseem/Client.java

This file was deleted.

31 changes: 31 additions & 0 deletions pattern/src/me/premaseem/Client.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package me.premaseem;

import me.premaseem.remotes.SetTopBoxRemote;
import me.premaseem.remotes.SoundSystemRemote;
import me.premaseem.remotes.TVRemote;

/*
@author: Aseem Jain
@title: Design Patterns with Java 9
@link: https://premaseem.wordpress.com/category/computers/design-patterns/
*/
public class Client {
public static void main (String[] args) {
System.out.println("Master Remote Facade ");

// Client is tightly coupled with sub systems
TVRemote tvRemote = new TVRemote();
SoundSystemRemote soundSystemRemote = new SoundSystemRemote();
SetTopBoxRemote setTopBoxRemote = new SetTopBoxRemote();

// Turning ON requires several calls
tvRemote.trunOn();
soundSystemRemote.trunOn();
setTopBoxRemote.trunOn();

// Turning OFF requires several calls
tvRemote.trunOn();
soundSystemRemote.trunOn();
setTopBoxRemote.trunOn();
}
}
17 changes: 17 additions & 0 deletions pattern/src/me/premaseem/remotes/SetTopBoxRemote.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package me.premaseem.remotes;

/*
@author: Aseem Jain
@title: Design Patterns with Java 9
@link: https://premaseem.wordpress.com/category/computers/design-patterns/
*/
public class SetTopBoxRemote {

public void trunOn(){
System.out.println("Set Top box power turn ON ");
}

public void trunOff(){
System.out.println("Set Top box power turn OFF ");
}
}
17 changes: 17 additions & 0 deletions pattern/src/me/premaseem/remotes/SoundSystemRemote.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package me.premaseem.remotes;

/*
@author: Aseem Jain
@title: Design Patterns with Java 9
@link: https://premaseem.wordpress.com/category/computers/design-patterns/
*/
public class SoundSystemRemote {

public void trunOn(){
System.out.println("Sound System power turn ON ");
}

public void trunOff(){
System.out.println("Sound System power turn OFF ");
}
}
17 changes: 17 additions & 0 deletions pattern/src/me/premaseem/remotes/TVRemote.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package me.premaseem.remotes;

/*
@author: Aseem Jain
@title: Design Patterns with Java 9
@link: https://premaseem.wordpress.com/category/computers/design-patterns/
*/
public class TVRemote {

public void trunOn(){
System.out.println("TV power turn ON ");
}

public void trunOff(){
System.out.println("TV power turn OFF ");
}
}
13 changes: 0 additions & 13 deletions patternBonus/src/com/premaseem/Client.java

This file was deleted.