Reputation: 2859
I'm reading Head First Design Patterns book, on page 382 it says:
Composite Patterns is used when you have collection of objects with Whole-Part relationships. and you want to be able to treat those objects uniformly.
Upvotes: 12
Views: 8678
Reputation: 11
Part-whole is also related to Composite Pattern. Composite pattern provides a mechanism for treating groups of objects the same as an individual object (this is often known as part-whole hierarchy).
Upvotes: 0
Reputation: 4034
Basically, the term represents the construction of larger objects based on smaller ones. In the context of Composite Pattern both large and small objects are instances of same class.
Upvotes: 3
Reputation: 18368
Well, it's pretty straightforward - any object in a collection is a part of the whole composition and composition as a whole is a collection of parts.
Upvotes: 18