Difference Between Aggregation and Association


In this post, we will understand the differences between aggregation and association.

Association

It can be understood as an organization of people that have a common purpose. It also indicates that they consist of a formal structure. It represents a binary relationship between the two objects that describe some kind of activity.

It is a relationship between multiple objects.

An example would be how consuming healthy food is related not just to a healthy weight, but to good skin, good hair, strength and being active.

  • Association is a relationship between two classes where one class uses the other class.
  • It is not flexible in nature
  • This indicates that there is also some kind of link/relation between the objects.
  • It can be represented as a 'has a' relationship.
  • The components of a class can be linked using line segments.

Let us see how it can be represented −

Aggregation

It tells about a special type of an association that specifies a whole and a part of a relationship. It is a collection, i.e a group of things that are stored together.

  • It can be represented as a 'has a' and 'whole-part' relationship.
  • It can be understood as a group that has distinct parts
  • Example would be a single teacher teaches a group of children.
  • It is flexible in nature.
  • It is a special kind of association that consists of whole-part relation with respect to objects.
  • It has a diamond shape that is used after the assembly class.

Let us see how it can be represented −

Updated on: 02-Mar-2021

885 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements