Unit 4

Association, Aggregation and Composition

How objects work together: association, aggregation and composition, how to choose between them, UML class diagrams, and a mini-project that uses the whole module.

Objects rarely work alone. Classes are related to one another. These three relationships describe how objects are connected, and are different from inheritance (is-a). They are has-a or uses-a relationships.

What you will learn

After this unit you can:

Topics in this unit

4.1Association1 code example · 1 diagram✓4.2Aggregation1 code example · 1 diagram✓4.3Composition1 code example · 1 diagram✓4.4Comparing the Three1 diagram✓4.4.1How to decide1 diagram · interactive lab✓4.4.2Class diagrams1 diagram✓4.4.3Self-check and practice✓4.5Mini-Project: Library Management System1 code example · 1 diagram✓