Association is the relationship between two classes. When the association is between two classes, its called Binary Association. When the association is between two instances of the same class, then its called reflexive or unary association.
Example : Binary Association : Employee works for Employee
Unary Association: A Employee supervises Employees
For a given association between object A and object B, there can be three possible categories (the following are called mutiplicity).
- One to One. Exactly one instance of Class A is associated with exactly one instance of Class B and vice versa. Example: A department has exactly one Head and One Head can lead only one departmet
- One to Many : One instance of Class A can have many instance of Class B. From perspective of Class B, there can be only one Class A Example : A department employees many Professors, but a professor works only for one department
- Many to Many : For a given instance of Class A there can be many instance of Class B and From Class B perspective there can be many instances of Class A. Example : A student enrolls in many courses and a course has many students
Link is the relationship between two objects. There are no multiplicity concepts in links. Links always exists between two objects.
Link : Azagu works for Company-xxx
Aggregation : Aggregation is a special type of association or otherwise called as "Consists of " or " has a " or " is composed of " relationship. Like an association, aggregation is used to reprsent relationship between two classes. But with Aggregation we are representing to more number of relationship. Example, A car is composed of engine, gear, wheels etc.