Difficulty

Composite Pattern

Base for this pattern is creating a tree structure of objects. Having a tree node and leafs (children and parents). The node is commonly represented by an interface, but could also be a class. Also, leafs can be represented freely.

E.g. let’s have a restaurant offering a wide variety of meal options.
Food-MainCourse-Burger-VeggieBurger-IndianVeggieBurger
Food-MainCourse-Burger-VeggieBurger-BeetrootVeggieBurger
Food-MainCourse-Burger-VeggieBurger-TofuVeggieBurger-…
Food-MainCourse-Burger-VeggieBurger-…
Food-MainCourse-Burger-ClassicBurger-BeefClassicBurger
Food-MainCourse-Burger-ClassicBurger-FishClassicBurger
Food-MainCourse-Burger-ClassicBurger-…
Food-MainCourse-Burger-…
Food-MainCourse-…
Food-Soup-VeggieSoup-TofuSoup
Food-Soup-VeggieSoup-MashroomSoup
Food-Soup-VeggieSoup-…
Food-Soup-…
Food-…

Last update 04.08.2019.
For possible mistakes in content or typos, I apologise and kindly ask you to report here.