Login :
Password :

Design patterns

Composite

Static diagram :

Static diagram

Description :

Type :  St  (Structural)
Intent : Compose objects into tree structures to represent part-whole hierarchies. Composite lets clients treat individual objects and compositions of objects uniformly.
Applicability : Use the Composite pattern when:
- you want to represent part-whole hierarchies of objects.
- you want clients to be able to ignore the difference between compositions of objects and individual objects. Clients will treat all objects in the composite structure uniformly.

Strong points :

  1. 1. Decoupling and extensibility
    1. 1.1 Maximal factorization of the composition
    2. 1.2 Addition or removal of a leaf does not need code modification
    3. 1.3 Addition or removal of a composite does not need code modification
  2. 2. Uniform protocol
    1. 2.1 Uniform protocol on operations of composed object
    2. 2.2 Uniform protocol on composition managing
    3. 2.3 Unique access point for the client class

Pattern's participants :

Spoiled patterns :

  1. 1. Development of the composition on <<Component>>
  2. 2. Development of the composition on <<Component>> and <<Composite>>
  3. 3. Recursive composition
  4. 4. Development of the composition on <<Composite>> without protocol conformance
  5. 5. Development of the composition on <<Composite>>
  6. 6. Indirect composition on <<Composite>>

Problems :

  1. 1. Images composition
Les têtes de mule
Cédric BOUHOURS
Cédric BOUHOURS
Cédric BOUHOURS