Skip to content
Advertisement

Bridge pattern use and structural design patterns

I have a project where I am asked to include at least one structural design pattern, and I chose the a desktop app for food delivery, my thoughts where that I have an abstract class FoodElement that derives VeganFoodElement and a NormalFoodElement. Now for each category I can either choose a dish or a drink, can I separate them this way?

JavaScript

Advertisement

Answer

I recommend that you choose the Decorator pattern. This pattern helps you to use some elements to make new elements. For Example new Seafood(new BasicFood()) .

You can read more here

And here an example

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement