Problem Analysis  «Prev  Next»
Lesson 12Modeling composition
ObjectiveUnderstand and apply Modeling Composition

Understand and apply Modeling Composition

Composition is a strong form of aggregation. By strong, the UML means that the life span of the parts depends on the life span of the aggregate. The parts do not exist apart from their participation in the aggregate.
This strong affiliation implies physical objects that are assembled together to form the composite. For this reason, the multiplicity on the composite/diamond end of the association is always one.
Composition is equivalent to containment by value. So in computer-assisted software engineering (CASE) tools, the way you set the solid diamond is to adjust the containment criteria to "by value."

Modeling Composition

Composition is modeled the same as aggregation, with one exception. The diamond is filled in to represent composition. The diamond is not filled when representing aggregation. Multiplicity is still required to model how many part objects are configured into the composite.

Composition example
Composition example

Comparison of Aggregation and Composition

Below is a comparison of aggregation and composition:
Aggregation
Hollow Diamond
Composition
Solid Diamond
Multiplicity must be assigned on both ends of the association Multiplicity of one is implied at the composite/diamond end of the association
The parts may exist even after the aggregate is dissembled or destroyed Multiplicity must be assigned to the 'part' end of the association
Parts may be moved from one aggregate to another The parts no longer exist if the composite is dissembled or destroyed
 Parts may not be moved from one compost to another

Comparison of aggregation and composition 02
Comparison of aggregation and composition 02

Course Materials as an aggregate
Definition: Custom courses may be developed from existing courses by combining existing lessons and exercises and creating a new table of contents
Course Materials as a composite
Definition: Fixed courses are developed and delivered as is. To create a new course all of the material is created from scratch
The table of contents is unique for each course The table of contents is unique for each course
The table of contents refers to ever lesson in the course. The lesson is listed in the table of contents for every course it is used in. The table of contents refers to every lesson in the course. Each lesson is listed in only the table of contents for the course for which it was developed
The lessons are initially developed for one course but may be used to make other customer courses The lesson is only used in the course for which it was developed
The exercises are initially developed for one course but may be used with ouster lessons for other courses The exercises are only used in the lessons for which they are developed

Modeling Composition - Exercise

Click the Exercise link below to model aggregation and composition based on excerpts from the course project problem statement.
Modeling Composition - Exercise