wood burning stoves 2.0*
The moose likes OO, Patterns, UML and Refactoring and the fly likes aggregation vs composition Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "aggregation vs composition" Watch "aggregation vs composition" New topic

aggregation vs composition

Vzy Mar

Joined: May 03, 2009
Posts: 7

Just I wanted to know more details about the Composition. As per my understand, Composite object is made of the components. Or Components doesn't have any value without Composite object.

I would like to know that, Is above example will come under the Composition?.

Vzy Mar

Joined: May 03, 2009
Posts: 7
David Newton

Joined: Sep 29, 2008
Posts: 12617

Aggregation. Aggression means something else completely.

Please UseCodeTags when posting code or configuration. Unformatted code and configuration is unnecessarily difficult to read.

You can edit your post by using the button.
Vzy Mar

Joined: May 03, 2009
Posts: 7

Thank you for correcting me on post. I was in hurry while posting the question, never repeat the mistake again.
Vlad Varnica
Ranch Hand

Joined: Dec 28, 2002
Posts: 40
You can download an UML modeling tool and reverse your java code.
You will immediately see if it is detected or not as an aggregation.

btw, you code is for me a 1 to 1 association.
It is sorta covered in the JavaRanch Style Guide.
subject: aggregation vs composition
Similar Threads
Generic types
Q. Methods of a dead thread.
unable to access the attribute in any of the container scope
Problem with BeanUtils
is this correct way of implimenting comparable interface