nus-cs2103-AY2223S2 / forum

12 stars 0 forks source link

Week 8's Tutorial (Class Diagram) #421

Closed venuslimm closed 1 year ago

venuslimm commented 1 year ago

Hello, may I know why there isn't a composition between StockItem -> Review?

StockItem consists of Review. Also, Review cannot exist without StockItem, similar to how Rating cannot exist without Review.

Code: image

Answer given: image

damithc commented 1 year ago

@venuslimm delete cascading is a side effect of composition, not a sufficient condition for it.

image

Yes, a review cannot exist without a corresponding stock item, but conceptually, is a review part of a stock item? The answer may be subjective but it feels like reviews are entities in their own rights that get attached to stock items rather than being part of a stock item. Still, the decision for deciding if an association is actually a composition is not very clear cut.

venuslimm commented 1 year ago

Okay, thank you!