c# - OOP Associations philosophical concept -


i'm wondering pros , cons between below possibilities of association between classes. know it's general question , depends on specific case needs 'm wondering in general philosophical problem difference

1)

class order {     ilist<orderposition> positions; }  class orderposition {  } 

2)

class order {  }  class orderposition {     order order; } 

there third option create bidirectional association that's waste of memory guess.

that not same.

1) means order can have several orderpositions , not avoid orderposition found in multiple orders.

2) means orderposition can contained in one order.

there other implications if talk "composition"/"aggregation" (oop)


Comments