How to identify strong aggregation (composition) relationship between classes and what is difference between association and aggregation(while programming implementation of them)?

Questions by Pritesh Dubey

Showing Answers 1 - 15 of 15 Answers

rashmitambe

  • Apr 20th, 2007
 

In strong aggregation or composition, a part entity cannot exist without the containing whole entity in 'whole-part' relationship.
For example. an university has multiple department. This a composition relationship between university and department entity. A department cannot exist on its own with out the university.

  Was this answer useful?  Yes

Dusan B

  • Nov 2nd, 2007
 

Difference between association and aggregation (while programming implementation for both):

the main difference is conceptual - Aggregation says that an object is made up of other objects, and association says that they have a relationship, they know of each other, or they use each other in some way.

As far as programming, the main difference is in the multiplicities. Aggregation parent can have * and any subset of multiplicities here, but the child making up the aggregation can only have one parent.

This is different from association where you can have any number of possible relationships, going from 1-1, all the way up to *-*.

To clarify, when implementing aggregation Car and Tire, the Car has an aggregation to Tire, and the car has between 4-5 Tire (as an example, one is spare in the trunk) but in no case can a tire belong to two cars at the same time.

So when implementing the Car, you have to check that it has at least 4 and no more than 5 tires, and when implementing the Tire, you have to at all times have a reference to the Car (which means passing the Car reference in the constructor). Furthermore, when the Car reference is set to null, you have to pro grammatically make sure that the Tire references are also set to null in case of Aggregation but if u model your system as Car just having an association to Tire, this might not necessarily be true.

jherna

  • Sep 30th, 2008
 

First let me say that aggregation is not composition or viseversa.  The OOD concept is "Association" and there are two types.  Both are "Has a" relationships.  One is "Aggregation" (a strong "Has a") and the other is "Composition" (a weak "Has a"). 

AGGREGATION EXAMPLE:
A Person class is an the "aggregating" class and the Person object "has a" heart from the Heart class which is the "component" class.  When the Person class object is collected by garbage collection so does the Heart class object associated with that Person class object. 

COMPOSITION EXAMPLE:
An Engine class is an the "aggregating" class and the Engine object "has a" carbuator  from the Carbuator class which is the "component" class.  When the Engine class object is collected by garbage collection the Carbuator class object associated with that Engine class object does not go to the salvage yard.  It can go to another Engine object. 

  Was this answer useful?  Yes

Prof. M.Shamsunder

  • Dec 20th, 2014
 

Composition is known as strong Aggregation relationship or DEATH relationship. Example. Library composed of Books & Library has students. Now LIB & BOOKS is a Composition relationship, where as LIB & Student is a Aggregation. If We remove Books from LIB, then resistance of LIB will not be there. So it is a DEATH Relationship.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions