Composition In Java
Composition:
and both objects have identical lifetimes (GoF)
Aggregation - when one object has a collection of objects that can exist on
their own (UML)
Containment - a special kind of composition in which the contained object
is hidden from other objects and access to the contained object is only via
the container object (Coad)
- Method of reuse in which new functionality is obtained by
creating an object composed of other objects - The new functionality is obtained by delegating functionality to
one of the objects being composed - Sometimes called aggregation or containment, although some
authors give special meanings to these terms - For example:
and both objects have identical lifetimes (GoF)
Aggregation - when one object has a collection of objects that can exist on
their own (UML)
Containment - a special kind of composition in which the contained object
is hidden from other objects and access to the contained object is only via
the container object (Coad)
