I'm programming a coffee machine with many kinds of coffee. I offer normal coffee, espresso, cappuccino, but also Irish coffee (whiskey, coffee, sugar, whipped cream), Spanish Coffee (Cointreau, cognac, coffee, sugar, whipped cream) and Italian Coffee (Amaretto, coffee, sugar, whipped cream).
I'm planning to add more kinds of coffee in the future, that's why it needs to be easy to add more coffees without adding a class for each kind.
My solution would be to use the decorator pattern. However this will leave me with so many decorators like SugarDecorator
, MilkDecorator
, WhiskeyDecorator
, AmarettoDecorator
, WhippedCreamDecorator
...
How can I fix this without adding a decorator for each condiment?
Aucun commentaire:
Enregistrer un commentaire