When defining a relationship with a customer and credit card ..which one is more suitable assoicaation or aggragation..Both of them makes sense.. Thanks,
posted 13 years ago
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)
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads