I am very confused about the differences between Associations and Aggregations as both are almost the same, and both objects in the relation can exist without the other.
There is a post on stack overflow trying to explain this
Association - I have a relationship with an object. Foo uses Bar
public class Foo {
private Bar bar;
};
Aggregation - I have an object which I've borrowed from someone else. When Foo dies, Bar may live on.
public class Foo {
private Bar bar;
Foo(Bar bar) {
this.bar = bar;
}
}
source {https://stackoverflow.com/a/10394722}
Both looks almost identical to me, can someone explain when is a relation an association and when is it an aggregation.