Monday, June 25, 2012

Composite Pattern


Composite

A composite IS A group of objects in which some objects may contain others, so that some objects represent groups and others represent
individual items, or leaves.

You can bring these ideas together by defining a common type for groups and items and modeling groups as containing a collection of objects of this type.

The intent of the COMPOSITE pattern is to let clients treat individual objects and compositions of objects uniformly.




In software engineering, the composite pattern is a partitioning design pattern.
The composite pattern describes that a group of objects are to be treated in the same way as a single instance of an object

When to use
Composite can be used when clients should ignore the difference between compositions of objects and individual objects.
If programmers find that they are using multiple objects in the same way, and often have nearly identical code to handle each of them, then composite is a good choice; it is less complex in this situation to treat primitives and composites as homogeneous

http://en.wikipedia.org/wiki/Composite_pattern

No comments:

Post a Comment