1.Topics‎ > ‎Architecture‎ > ‎Patterns‎ > ‎a.Design Patterns‎ > ‎C.Structural Patterns‎ > ‎


  1. Summary
    1. Composite patterns are uses to implement whole – part relationship and mostly utilized to implement tree data structure.
    2. The intent of this pattern is to compose objects (Node) into tree structures to represent part-whole hierarchies.
    3. Client treats Composite (node) and individual objects (leaf) uniformly.
  2. Tutorials
    1. http://www.oodesign.com/composite-pattern.html
  3. When to Use
    1.  The composite pattern applies when there is a part-whole hierarchy of objects and a client needs to deal with objects uniformly regardless of the fact that an object might be a leaf or a branch.
    2. Graphics Editors use composite pattern to implement complex and simple graphics as previously explained.
    3.  File System implementations use the composite design pattern as described previously.
  4. Specific Considerations
    1. Composite Vs Decorator
      1. Decorator is often used with Composite. When decorators and composites are used together, they will usually have a common parent class
      2. So decorators will have to support the Component interface with operations like Add, Remove, and GetChild.