Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why are the relationships Association, Aggregation and Composition requried

 
ragi singh
Ranch Hand
Posts: 198
Oracle Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all ,

I have read on the relationships association , aggregation and composition but am unable to follow as to why they are required . Is it that we create the classes and since a particular class holds reference to another that we term the two classes to be in association relation , so what is the use of defining relationships , are we using them(relations ) to identify relationship in a particular scenario or while designing we decide our class will have relation with another class so in the diagram we declare it as an association or aggregation or composition . Please explain ....I understand their definitions and the differences between them , i want to know why were these relations designed and what are the advantages if i use the m?


Thanks and Regards.
 
Mohamed Sanaulla
Saloon Keeper
Posts: 3159
33
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
These relationships are used for better OO design. And you would be most of the times using these relationships in your development.
 
Matthew Brown
Bartender
Posts: 4567
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The advantage is that it allows your model to more closely represent what it is you're trying to model. The different types of relationship mean slightly different things, and so using the right one gives more precise information. Which is a good thing.

Having this extra information may help you make design decisions when you get round to implementing the model. For example, deciding which classes have responsibility for creating instances of other classes.
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
These "relationships" represent ways that objects can interact with other objects. They are a fundamental part of the Unified Modeling Language (UML). However, they are not "required" for anything. but they are the only way that you can describe the "relationship" between objects and classes using the UML.

Asking why they exist is like asking why the word "the" exists in the English language. It would be extremely difficult to communicate effectively if the word "the" did not exist
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic