I know there are many articles and many answers on this question but I really not understand it.I read many answers but I not understand it fully. I know what is association, aggregation, composition. My question is simple that what is the difference between only aggregation and association and when to use them. I am not talking about composition. For example course and student are two classes. Now which relationship is between them. Is association or Is aggregation ?
-
2Possible duplicate of [difference between association and aggregation](https://stackoverflow.com/questions/13044984/difference-between-association-and-aggregation) – qwerty_so May 04 '18 at 15:04
-
I already read that article. Please tell me what will be the relationship between student and course. Aggregation or association ?? – Zeeshan Safdar May 05 '18 at 04:41
-
It's Association. – qwerty_so May 05 '18 at 06:34
-
Thanks Thomas Kilian for your answer. – Zeeshan Safdar May 09 '18 at 07:53
1 Answers
"Aggregation" means to add things together. In the context of UML class modelling it means that one class is part of another class. To be clear (it sounds like you already know) composition is a form of aggregation -- composition simply means that the class that is being composed cannot exist outside the composing class (also known as "strong aggregation"), whereas aggregation means that the composed can exist outside of the composing (also known as "weak aggregation"). For example, a car might aggregate four wheels but these wheels can exist when removed from the car (weak form), whereas the mind cannot exist outside of the brain (strong form).
"Association" means that two things are associated somehow. It means nothing more than that in the context of UML class modelling.
Given this, it seems obvious that the relationship between a "Course" and a "Student" is an association as neither aggregates the other. That is assuming that you and I mean the same thing by Course and Student, of course.

- 2,312
- 9
- 13