• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Association vs Aggregation

 
Susan
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 311
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Thomas Taeger
Ranch Hand
Posts: 311
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic