Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Association vs Aggregation

 
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
 
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.
 
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 ]
 
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 ]
 
Ranch Hand
Posts: 1491
  • 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
 
The knights of nee want a shrubbery. And a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic