Composite Pattern
Source:: Software Design Patterns - Best Practices for Software Developers
Definition
The composite pattern is defined as composing objects into tree structures to represent part-whole hierarchies, thus letting clients uniformly treat individual objects and composition of objects.
This allows us to treat both individual objects and compositions in a uniform manner, meaning that the same behavior will be applied regardless of whether we’re working with one item or a thousand.
- [!] Composite pattern should be applied only when the group of objects should behave as the single object.