Last active
August 29, 2015 14:22
-
-
Save up1/011da277d9cd1041de8b to your computer and use it in GitHub Desktop.
Refactoring :: Rule of Three
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void askQuestion() { | |
if (currentCategory() == "Pop") | |
System.out.println(pop.removeFirst()); | |
if (currentCategory() == "Science") | |
System.out.println(science.removeFirst()); | |
if (currentCategory() == "Sports") | |
System.out.println(sport.removeFirst()); | |
if (currentCategory() == "Rock") | |
System.out.println(rock.removeFirst()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void askQuestion() { | |
if (currentCategory() == "Pop") { | |
Object message = pop.removeFirst(); | |
System.out.println(message); | |
} | |
if (currentCategory() == "Science") { | |
Object message = science.removeFirst(); | |
System.out.println(message); | |
} | |
if (currentCategory() == "Sports") { | |
Object message = sport.removeFirst(); | |
System.out.println(message); | |
} | |
if (currentCategory() == "Rock") { | |
Object message = rock.removeFirst(); | |
System.out.println(message); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void askQuestion() { | |
if (currentCategory() == "Pop") { | |
Object message = pop.removeFirst(); | |
showMessageOnConsole(message); | |
} | |
if (currentCategory() == "Science") { | |
Object message = science.removeFirst(); | |
showMessageOnConsole(message); | |
} | |
if (currentCategory() == "Sports") { | |
Object message = sport.removeFirst(); | |
showMessageOnConsole(message); | |
} | |
if (currentCategory() == "Rock") { | |
Object message = rock.removeFirst(); | |
showMessageOnConsole(message); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void askQuestion() { | |
if (currentCategory() == "Pop") { | |
showMessageOnConsole(pop.removeFirst()); | |
} | |
if (currentCategory() == "Science") { | |
showMessageOnConsole(science.removeFirst()); | |
} | |
if (currentCategory() == "Sports") { | |
showMessageOnConsole(sport.removeFirst()); | |
} | |
if (currentCategory() == "Rock") { | |
showMessageOnConsole(rock.removeFirst()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment