Table of Contents

About

composition is a containment relationship of physical type where the content entity is a part of a container entity

This relationship is also known as:

composition is also known as physical containment because when the container is destroyed, the content entity is supposed to be destroyed (whereas in a aggregation containment it is not)

The container is said to be a composite type.

Composition aims to tackle the specialization of some entity.

It's a binary association (link between only two element).

A composition introduce a dependency relationship.

composition: same as wrapper + injection through parameters set. ?

Example

  • an engine is part of a car
  • a windows is composed of a slider, an header, a panel
  • a parent child relationship

Visualisation

Example in an class diagram

Uml Composite Aggregation

Composite Pattern

See Tree - Composite Type (Design Pattern)