About
A containement is a type of relationship between a container element and a content element that model a has a relationship
There is two type of containment:
- physical (composition) aims to build an object from other objects (relation 1:1) and is a dependency relationship.
- catalog (aggregation) aims to groups objects (relation 1:n) and is not a dependency relationship.
Type
Physical
physical containment called composition where the content object cannot exist without its container. (ie when applied in a software, the content object will be destroyed with its container - also called a cascade delete)
Example:
- a car and an engine
- parent child relationship
Catalog
catalog containment called aggregation where the content object can exist without its container (ie when the container is destroyed, the content objects will not)
Example: a class and its student