Composite pattern

Build bigger objects from smaller ones. The sum acts like one of the parts

Useful for project management / hierarchy tree structures & where you don't want to care whether it's a leaf node or not.

All objects must have a common 'Component' Interface.

GUI's use this pattern a lot.

composite pattern

Edit this at http://yuml.me/edit/475b8d16

The subcomponents implement the component interface.

Page created on 6 Jun 2020