permaculture playing cards*
The moose likes OO, Patterns, UML and Refactoring and the fly likes Associations in OOPs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Associations in OOPs" Watch "Associations in OOPs" New topic
Author

Associations in OOPs

sreedhar Lackka
Ranch Hand

Joined: Jul 05, 2008
Posts: 154
Hi All,

Thanks in advance.

I am aware of different Associtaions are Composistions,Aggregation and Generalization.

Could any one please explain in simple terms about the differences and where and why we should use them in our applications.

And, How one association can be translated to Java like suppose if I want to translate composistion how it will be seen in Java.


Thanks,
Sree
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3013
    
  35

Please have a look at AssociationVsAggregationVsComposition


Founder of ExamLab and Systemup
See how I can help you to become an awesome programmer
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
Just for clarity, Composition, Association and Aggregation are specific types of UML "relationships."

Association is a relationship between two classes.

Composition is a relationship between two classes.

Aggregation is a relationship between two classes.

sreedhar Lackka
Ranch Hand

Joined: Jul 05, 2008
Posts: 154
Hi,

Thanks a lot for the reply.

I was aware of these basics but could any one please let me know, with a Java code as an example.
And mostly I would like to know the difference between Composition and Generalization.

Regards,
Sree
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3013
    
  35

Have a look at this topic for some examples.
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
An example of the UML concept of Generalization :



GeneralBook is a "Generalization" of DetailedBook. And, DetailedBook ISA GeneralBook.


An example of the UML concept of Composition *:



* When the Car is destroyed the Driver is destroyed as well. The application is designed this way.
sreedhar Lackka
Ranch Hand

Joined: Jul 05, 2008
Posts: 154
Thanks a lot for your information!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Associations in OOPs
 
Similar Threads
calculate todays date minus last one year in java
Replace Class Files
Need a Help!!
uploading file
Down loading software