Definition:
The intent of Composite pattern is to let clients treat individual objects and compositions of objects uniformly.

What is:
Composite pattern

Example:

1. Bob Tarr’s composite pattern

2. AppLab’s Composite pattern

3. A look at the Composite design pattern

Bitter:

Composites, Tree and Cycle
Modeling  composites often leads to recursive definition of methods on composite nodes. When recursive is present, there is danger of writing code that produces an infinite loop. To avoid such problems, you can take steps to guarantee that your composites are always trees. If you can allow cycles to occur in a composite, but you have to modify your algorithm to watch for infinite recursion.

Advertisements