Home > DeveloperSection > Forums > OOPS Design concepts - difference between association and aggregation
marcel ethan
marcel ethan

Total Post:105

Posted on    October-05-2015 4:58 AM

 Java C#  Java  OOPS 

 1 Reply(s)
 633  View(s)
Rate this:
I am pretty confused about oops design principles. In UML class diagram there are notations of association and aggregation. I want to undersatnd what is the exact difference between these two, because according to me these are very similar and used for same purpose    

Mayank Tripathi
Mayank Tripathi

Total Post:397

Posted on    October-05-2015 7:15 AM

Association is a relationship between two objects. In other words, association defines the multiplicity between objects. You may be aware of one-to-one, one-to-many, many-to-one, many-to-many all these words define an association between objects. Aggregation is a special form of association. Composition is a special form of aggregation. 
ExampleA Student and a Faculty are having an association.

Aggregation is a special case of association. A directional association between objects. When an object ‘has-a’ another object, then you have got an aggregation between them. Direction between them specified which object contains the other object. Aggregation is also called a “Has-a” relationship
Example : (City, Tree, Car) "sub objects" (Tree, Car) will NOT be destroyed when City is destroyed.

Don't want to miss updates? Please click the below button!

Follow MindStick