Association and Its Implementation

Learn about association, its importance, and its implementation using a real-life example.

What is association?

In contrast to a composition or aggregation, where a part is an integral component of the whole object, an association links two otherwise unrelated objects. Similar to aggregation, the associated object can belong to multiple objects simultaneously. However, unlike an aggregation, where the connection is always unidirectional, an association can be either unidirectional or bidirectional, where both objects are aware of each other.

Real-life example

The bond between doctors and patients is an example of an association. While a doctor has a connection with their patients, it is not a part-whole relationship conceptually. A doctor may see numerous patients in a day, and a patient may visit multiple doctors for a second opinion or to seek different types of medical attention. Neither object’s lifespan is linked to the other.

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy