Skip to content

Conversation

@KKSmith125
Copy link
Owner

No description provided.

public final void order(String addition) {
boilWater();
createDrink();
serveDrink();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AM-1: The hook method should be on the base class. The subclasses can implement "helper" private methods, but not other public methods.


userDrink.boilWater();
userDrink.createDrink();
userDrink.serveDrink();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AM-2: You should only be calling the order method. Without it you are not enforcing the pattern.

userDrink.serveDrink();

if (userChoice.equalsIgnoreCase("coffee")) {
System.out.println("Would you like milk and sugar with your coffee (y/n)?");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AM-1.5: The code inside here should be the hook method, and in the base class you default it to false. As this is now the Drinks are not using the template method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants