This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
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?
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.
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