I’ve been discussing with my co-workers when we have to use Aggregation or Association in UML models. Martin Fowler in UML Distilled, 3rd Edition says aggregation is the part-of relationship. It’s like saying that a car has an engine and 4 wheels as its parts. But aggregation was included in UML to differentiate from association, because in pre-UML days people didn’t knowhow to differentiate them. But aggregation, as Fowler says, is meaningless. Jim Rumbaugh says “Think of aggregation as a modeling placebo”. Association is a way to notate a property in our classes, but you don’t manage the life cycle of the associated property, as the aggregation relationship do. The solid line between the classes define the way one instance of the associating class can execute methods (operations realizations) of the associated object. So, why to use aggregation?
Subscribe it
The opinions expressed here are entirely my own and do not necessarily reflect those of my employer.
Tags
agile ajax analysis android api apple bean blocks closures code css ddd delegate design design_patterns development dip eclipse firefox framework functional general google java java_programming jfilecontentmanager joshua block junit lgpl management mobile ooad oop patterns programming ruby scala scrum software tech testing tests tools twitter web2.0Last Searches
- assertThat typesafeMatcher
- java enum extend singleton
- joshua enum singleton
- hamcrest list
- equal collections junit
- enum singleton
- hamcrest equals
- hamcrest Matcher bean
- java bean compare
- hamcrest imports
- grasp pattern example
- hamcrest matchers scala
- Hamcrest equalTo
- junit custom matcher
- hamcrest junit equal list
- setEnabledForExtensions ruby
- hamcrest assert collection
- custom matcher junit
- Junit custom IsEqual matcher
- livejournal tags












My LinkedIn
#1 by dserodio on June 14, 2006 - 5:25 pm
What about Composition?
When you say , don’t you mean Composition ? IIRC, the link where you manage the lifecycle of the linked object is Composition.
It’d be interesting to note the differences between Association, Aggregation and Composition.
#2 by rnaufal on June 16, 2006 - 1:27 am
Re: What about Composition?
Yeah, you’re right. I think I’ve expressed myself a little bit confused.
Association is a way to notate a property in a class, in UML we have a solid line connecting the two classes, this notify how an object of the associating class can execute methods of the associated object in runtime. Composition means you control the life cycle of the composed object, so if an order has suborders and if the order becomes destroyed, the suborders are destroyed too. All of them has different meanings and UML notations, but the same implementation.
#3 by bpfurtado on July 11, 2006 - 12:47 am
I personally use the aggregation notation in a sense to give a more important role to the side of the relation which holds the empty diamond. Drawing my UML sketches (the way I like more to use UML) I use it just like that, without any formal meaning, without worrying too much about it.
The part-of meaning of it it’s just not that appealing to me.