| Lesson 12 | Modeling composition |
| Objective | 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.
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.
Multiplicity is still required to model how many part objects are configured into the composite.
Below is a comparison of aggregation and composition:
| 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 | Te exercises are only used in the lessons for which they are developed |
Click the Exercise link below to model aggregation and composition based on excerpts
from the course project problem statement.
Modeling Composition - Exercise
Modeling Composition - Exercise