• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Confuse on use of Composite and Aggregate.

 
Manny Pacman Pacquiao
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't w/c view to follow. Is it client or airline view?

I'm following this as base concept:

1. Composite is a car to its wheels
1..*

2. Aggregate is a company to its departments
1..*

I'm following that if the relationship is 1..* then it's either
a Composite or Aggregate.

Are there tips around w/c would help me strongly say it's an aggregate or composite?
 
Joseph A Alexander
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Composite Aggregation is a special type of aggregation.

In any business scenario, if the Child objects cannot survive (or cannot be created) outside the parents instance, then that Parent-Child share a Composite Aggregation relationship.

Please note that this is not the forum to talk about basics of the UML.

Regards,
Joseph, SCEA

[ January 30, 2007: Message edited by: Joseph Alexander ]
[ January 30, 2007: Message edited by: Joseph Alexander ]
 
Lars Behnke
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I recommend taking Martin Fowlers advice of not using aggregation at all: "Aggregation is strictly meaningless; as a result, I recommend that you ignore it in your own diagrams".

My addition to that recommendation is to only draw compositions if you are absolutely sure that parts (instances!) are not shared. In my assignment I used simple associations in most cases. And things worked out for me.

Lars
SCEA
 
Rizwan Mohammad
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please note that this is not the forum to talk about basics of the UML.


I don't agree with you. UML is part of SCEA syllabus.
 
Manny Pacman Pacquiao
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Replies were extremely helpful, made me looking here http://www.martinfowler.com/bliki/AggregationAndComposition.html

I still need to get real clear on this statement though "composition - Is that an object can only be the part of one composition relationship".

GroceryBag to GroceryItems(a 1..* multiplicity) is a composition relationship. Right?
 
Devender Thareja
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Grocery bag, IMO, is not a composite of grocery items. It seem an aggregate to me.
 
Lars Behnke
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good example. I'd try to keep things simple, so I'd model an association.

IMO, you can find arguments for both aggregation and composition: Item can exist without bag (->aggregation) but can only belong to one bag at a time (->composition).

If the focus of your system is on the lifecycle of the grocery item, I'd opt for an aggregation. If the focus of your system is on the process of bringing your items in a grocery bag home, I'd opt for a composition.

Lars
 
Manny Pacman Pacquiao
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok. Thanks! That's it, it's the view/focus/semantics that matters whether to classify as aggregate or composite. In my class diagram my focus is on semantics since it's a high-level view and isn't tied to software components.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic