OOPS DESIGN CONCEPTS - DIFFERENCE BETWEEN ASSOCIATION AND AGGREGATION

marcel ethan

Total Post:105

Points:735
Posted by  marcel ethan
C#  Java  OOPS 
 680  View(s)
Ratings:
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    
  1. Mayank Tripathi

    Post:397

    Points:3117
    Re: OOPS Design concepts - difference between association and aggregation

    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.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!