I want to make a small application which will return me a pizza based on the inputs given. I want to make a medium size pizza with different inputs 1. like white dough or brown dough 2. cheese toppings of different types, say white or brown cheese 3. different toppings of onions or tomato or mushrooms
So how do we decide which pattern to choose here, Builder or Decorator? I feel we can use builder pattern to make pizza first and then one we can use decorator pattern and decorate the pizza based on the different toppings we choose.Am I correct in this understanding? As I understand, decorator pattern is used to decorate any already existing object. To create this existing object, we would use builder pattern first.
Aucun commentaire:
Enregistrer un commentaire