News for hackers. Stuff that matters.
Re:Inheritance Is Terrible by cubano on Saturday March 19, 2016 @05:27PM (#11320543)
Yes totally agree.

The best way that I learned OO was when it was explained that, in most cases, its best to take objects as nouns (ie Item, Book, Prices etc) and the object methods should be verbs (ie do_something() or act_on_this() etc)

Re:Inheritance Is Terrible by thomasahle on Saturday March 19, 2016 @05:51PM (#11320647)
'item.add_to(cart)' seems to work fine from a gramatical point of view. It's only when we think in terms of ownership "The cart should own the item" that we choose the right order, no?
Re:Inheritance Is Terrible by wvenable on Saturday March 19, 2016 @05:53PM (#11320652)
cart.add(item) is also grammatical and less conceptually complex than any sort of "add_to" construct.