Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Association, aggregation, composition in class diagram

 
Parag Doshi
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do we need to show aggregation or composition relationship between 2 classes or is just association with cardinality information good enough to get your message across?
I know aggregation and composition are just a refinement of the aggregation relationship, but, do we need to go to that level of detail in the class diagram?

any suggestions would be appreciated.

Thanks,
parag
 
Tomi Tuomainen
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think we should use aggregation or composition just to show that we know UML. I'm thinking to use composition in just one or two places where it is really obvious. Aggregation is something in between and usually heavy usage of that is just confusing. Clear design is what we should aim for.

This is just my opinion though, I don't know what the examiner thinks...

Tomi
 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Martin Fowler says in UML Distilled: "Aggregation is strictly meaningless; as a result, I recommend that you ignore it in your own diagrams".

Composition is a more defined property and should be used, in my opinion, when it clarifies the design.

Regards,
Dan
 
Parag Doshi
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the replies guys ! What about navigability? do we also need to explicitly show the navigability between associations (things like, unidirectional, bidirectional, unspecified etc)? Or is it enough to show navigability of some associations and leave the rest as unspecified (no arrow heads..just plain straight lines).

any suggestions appreciated..

thanks,
parag
 
Tomi Tuomainen
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll probably follow Cade's example and define navigation in about every relationship. Though I'm not sure why Cade didn't use navigation in couple of places... Perhaps when there's just 1-1 relationship, navigation is not that important.

Tomi
 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Parag,

I would choose to be explicit about navigability.

You see 'no arrow heads..just plain straight lines' leaves things unclear because UML allows you to use this form either to indicate a bidirectional association or when you aren�t showing navigability.

So altogether, I think navigability is important enough to be clear about it. After all this is the major relationship among classes.

Regards,
Dan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic