Its comforting to see that other have the same reaction as me - I agree with the sentiment that you send messages to objects - and the naming of those messages and their context is important.and CD.buy - is at least a message to an object but as others have commented, it�� highlights flaws in the context or modelling as it just doesn't read right. I'd model it different too.Phew, I'm not losing it....TimOn Fri, 16 Apr 2021, at 2:44 PM, Russ Whaley wrote:Wow, I must be missing a whole lot of context in that discussion...�� (instant reaction as well, lol)- a product (CD, book, etc.) does not 'buy' - it can be bought, sure, but it has no buying��action.�� Even in another context a CD does not 'play'... aMusicPlayer.play(aCD).- However, a��customer can 'buy' a product...��
- customer.buy(aCD) -or-
- customer.addToCart(aCD)
- customer.checkOut(aCart)
- Invoice.new(aCart), etc.��
- ... but the CD doesn't DO anything.��- I get the idea that different products might have different behaviour when they are 'bought' - but these are, in this example, fulfillment - not the 'buy' action...��
- aCDstream��might be set for download
- aCDphysical might be set to physically pull off a shelf and ship
- aCDcare might send an email on warranty, whatever... but let's name it better than 'buy' :)
Tim, thanks for the link - I'm always trying to expand my thinking about object modeling - discovering cool ways/things others are��thinking about...�� Now I have to go dust off all my old POS (point of sale, not piece of s#&t) code and see how poorly I may have modeled those environments!!Thanks for the morning diversion!�� Cheers.On Fri, Apr 16, 2021 at 8:53 AM Esteban Maringolo <emaringolo@gmail.com> wrote:I saw a tweet about that, and I think that the example is misleading, maybe intentionally so.I don't think anybody would model it that way, in any case you'd have aProduct.buy() or aProduct.addToCart(aCart).��If you think it with the typical dog.bark() it certainly makes more sense than bark(dog).Regards!Esteban A. MaringoloOn Fri, Apr 16, 2021 at 5:20 AM Tim Mackinnon <tim@testit.works> wrote:Hi guys - someone pointed out this article from a UK colleague which seems to be causing a flurry of discussion - but I always like the insights of this group. I had an instant reaction when I read it - but curious what people here think in 2021.Tim--Russ Whaley