This is the understanding I have about Association, Aggregation and composition as of now.
Association
public class Foo {
void Baz(Bar bar) {
}
};
Aggregation
public class Foo {
private Bar bar;
Foo(Bar bar) {
this.bar = bar;
}
}
Composition
public class Foo {
private Bar bar = new Bar();
}
I think there is no point in understanding what the words mean, unless I can't represent it in actual code. The above code was taken from a SO answer (tell me if the above code is wrong).
My questions are the fllowing.
1) Is aggregation and composition important to be shown in a class diagram
2) I used a tool which can convert the java .class files into a class diagram. Class Visualizer but i was unable to make this tool show aggregation or composition relationships in the class diagram. Is that a problem with the tool or I have not understood how to use composition and aggregation in code? When I used the above code for association the tool gave me a representation of "dependency" relationship. (a dashed line)