Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

assoication or aggreagation ???

 
rethna pillai
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When defining a relationship with a customer and credit card ..which one is more suitable assoicaation or aggragation..Both of them makes sense..
Thanks,
 
noel angel
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ratha,
Essentially an aggregation is an association. With aggregation you get into the finer detail of whether the object can exist independently - can't then it lives and dies with its containing parent - called composition - filled in diamond. It can live independently - aggregation.
Most objects are held by reference in associations; they may also be held by value - containment type by ref or value. Here is where the arguments start. Some feel that there is no need for aggregation to be shown on a class diagram. Others feel it is absolutely necessary. You can complete most class diagrams without using aggreagtion and they are correct.
Example: A Car has wheels - It is an aggregation. I maintain that it depends on the context of the system being designed. A car rental company uses a car object that is complete and has all of its' parts. Would you show all of the parts of a car in a class diagram for a car rental company. No it is too much. But if the car needs a new wheel it leaves the system rental and goes into a system maintenance where the individual parts of a car are important.
It depends on the context of the problem that you are trying to solve.
I hope that this has shed some light on the differences.
Noel
SCJP, SCWCD, SCEA(Part 1)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic