Aggregation:
  • it is an association in which one class belongs to a collection
  • this is part of a whole relationship where a part can exists without a whole 
  • a line item is a whole and product is a part. if a  line item is deleted then corresponding product need not be deleted
  • so aggregation has a weaker relationship
Composition:
  • it is an association in which one class belongs to a collection
  • this is a part of a whole relationship where a part cannot exist without a whole
  • if a whole is deleted then all parts are deleted
  • an order is a whole and line items are parts. if an order is deleted then all corresponding line items for that order should be deleted
  • so composition has a stronger relationship