Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Question about composition

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
While preparing part II, I came across this question with regard to composision.
UML Distilled (page 86, figure 6-6 in my copy) has a composition relationship between Point and Polygon, and explains that "deleting a Polygon would cause its associated Points to be deleted...".
Reviewing Cade's study guide and his class diagram in the case study (page 169, figure 8-6), I would have tought there would be a similar relationship between Order and LineItem. Would removing an Order not also remove the LineItems associated with it? If not composision, would this not at least be aggregation? Meaning that an Order it made up of LineItems, but that a LineItem can exist after an Order is deleted (to preserve the relationship between LineItem and Product)?
Just trying to get a better handle on this so I get my relationships correct in my asssignment. Thanks for any help.
Art
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You answered the question yourself. If deleting the order does not delete the LineItems, then it is not a composition but an aggregation. But you have to understand, this comes from the business requiremnets. ie., whether or not the relationship is a composition( or an aggregation) is driven by the business requirements and not the other way.
Hope that helps,
 
Or we might never have existed at all. Freaky. So we should cherish everything. Even this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic