File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Implementation of Association and Aggregation Relationships. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Implementation of Association and Aggregation Relationships." Watch "Implementation of Association and Aggregation Relationships." New topic

Implementation of Association and Aggregation Relationships.

Chaminda Amarasinghe
Ranch Hand

Joined: May 17, 2006
Posts: 404

Hi Folks,

I have a doubt on implementing an aggregation relationship.

By definition an aggregation is strong type of association. In the definition there is no any indication about multiplicity of both association or aggregation. So according to that implementation (java code) of association and aggregation relationship should be same.

But in real world and examples give for these relationships, aggregation has always many (*) relationship at least in one side while association has always a one to one. My understanding according to definitions is an Association can be both O2O and O2M for an example "A class has a Teacher and A class has Many students", as well as Aggregation can be both both O2O and O2M ( one side is the aggregator ) for an example "Teacher is a part of Class and Students are part of Class". Here I gave the same example for both association and aggregation because If i hvn't not misunderstood, defining a relationship as an association or an aggregation is specific to domain or context.

Can someone please explain why all most all examples for aggregation indicate a many relationship (using a Collection like List, Map etc.. ) or is my understanding wrong?

Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
Your understanding is correct.

One example is an order has a billing address. This is one-to-one relationship. A Billing address is a aggregate.
Please notice that the address part can be shared.

There is a stronger form called Composition, for example I am composed of a heart which cannot be shared, otherwise I will die.

SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
I agree. Here's the link:
subject: Implementation of Association and Aggregation Relationships.
It's not a secret anymore!