Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
  • 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 ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
  • Tim Holloway
  • Carey Brown
  • salvin francis

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.
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,
The overall mission is to change the world. When you've done that, then you can read this tiny ad:
professionally read, modify and write PDF files from Java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!