File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Association vs Aggregation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Association vs Aggregation" Watch "Association vs Aggregation" New topic
Author

Association vs Aggregation

Susan
Ranch Hand

Joined: Apr 26, 2005
Posts: 54
Hi,

I understand the UML relationships being association & aggregation - and that aggregation is a more specialized annotation of an association.

However, what I would like to know is under what context do you use these relationships? For instance, a course has many students can be modelled as either an association or aggregation?

Any help here would be appreciated.


thanks,

Susan
tony clare
Ranch Hand

Joined: Apr 19, 2006
Posts: 31
it can be either association or aggregation depend on the time of your understanding. use association if you're not sure it's aggregation or composite aggregation.
Joyce Lee
Ranch Hand

Joined: Jul 11, 2003
Posts: 1392
Hi Susan,

There is a significant difference between association and aggregation. For aggregation, a whole cannot be its own part - forming a cyclic relationship. For example, if both Student and Course objects have a reference of each other, aggregation cannot be applied here.

According to UML for Java Programmers p. 36 and The Object Primer : Agile Model-Driven Development with UML 2.0 p. 50, the notation for aggregation has been dropped from UML 2.0.

Joyce
[ April 24, 2006: Message edited by: Joyce Lee ]
Thomas Taeger
Ranch Hand

Joined: Dec 16, 2002
Posts: 307
Hi Joyce,
Originally posted by Joyce Lee:
the notation for aggregation has been dropped from UML 2.0.

I can not really beleave it. In "UML 2.0 in a Nutshell", one of the rar good UML books, Aggregation is still a topic, see page 27.

Thomas


www.classic-and-class.com - www.evalulearn.com
Interfaces are the glue of OO.
Thomas Taeger
Ranch Hand

Joined: Dec 16, 2002
Posts: 307
Hello Susan,

Aggregation formally allways can be substituted by an Association.

But semantically an Association is stronger. You may use it if you want to depict that a whole owns the parts (not necessarily exclusively).

One author advices to use Aggragation only after defining a common understanding and use of it within the specific team.

Thomas
Joyce Lee
Ranch Hand

Joined: Jul 11, 2003
Posts: 1392
Hi Thomas,

I can not really beleave it. In "UML 2.0 in a Nutshell", one of the rar good UML books, Aggregation is still a topic, see page 27.

To be honest, I can't be sure whether aggregation has been dropped from UML 2.0 according to the authors' claim, that's why I cited the pages. Anyway, aggregation is still a topic in both books.

Joyce
[ April 24, 2006: Message edited by: Joyce Lee ]
kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1371
Originally posted by Joyce Lee:
the notation for aggregation has been dropped from UML 2.0.

If aggregation is deleted from UML 2.0, then composite aggregation also. Because composite aggregation is part of Agrregation. Please clarify.
Joyce Lee
Ranch Hand

Joined: Jul 11, 2003
Posts: 1392
Originally posted by kri shan:

If aggregation is deleted from UML 2.0, then composite aggregation also. Because composite aggregation is part of Agrregation. Please clarify.


The term aggregation we're discussing here (at least me) is shared aggregration.
Joyce Lee
Ranch Hand

Joined: Jul 11, 2003
Posts: 1392
Hi guys,

To clear the confusion, I e-mailed the author of The Object Primer, Scott Ambler, for clarification. He said that aggregation is back in UML 2.0 due to significant complaining within the community. Thanks.

Joyce
 
Don't get me started about those stupid light bulbs.
 
subject: Association vs Aggregation
 
Similar Threads
Why are the relationships Association, Aggregation and Composition requried
association and aggregation
Is that an association?
Association
aggregation,association,compositon