Abstract Pizza Factory Solution

create the pizza factories from last homework, and then make singleton classes for the topping and crust factories

he reason that those factories should be singletons is because if i had all three pizza factories instantiated, i would have 3 different ToppingFactories and 3 different CrustFactories instantiated, and that is wasteful since those factories do the same thing. Instead, if those factories were all singletons, then i would only have one of each (topping and crust) instantiated and not waste memory duplicating functionality. Each individual topping (onion, tears, etc) must still be its own instance, but not the factories that choose them.

Powered by