So, your code will not be closed for modification.
Remember: Designs should be open for extension but closed for modification.
class PizzaStore
Pizza class
What if you want to add/delete pizza types
Encapsulating Object Creation
into a Factory class
Reworking the PizzaStore class
SimplePizzaFactory simpleFactory = new SimplePizzaFactory();
PizzaStore pizzaStore = new PizzaStore(simpleFactory);
pizzaStore.order("Veggie");
Class diagram
No comments:
Post a Comment