News for hackers. Stuff that matters.
Re:Verb-Noun vs. Noun-Verb by rtkwe on Wednesday October 16, 2019 @04:35PM (#21275250)
Yes yes, english doesn't follow this noun-verb order but that's not what I'm actually talking about.

Usually the languages either encourage cards.shuffle().deal(4) or deal(shuffle(cards),4).

In the 'noun-verb'/OOP version the sequence of modifications follows the english reading order where basically I only have to keep information about the last result in my head. The functional verb-noun version I have to pop in and out of layers: 'ok we're dealing what?, something shuffled, what are we shuffling?, the cards object/variable, ok we're dealing shuffled cards how many are we dealing? 4.'

In general the noun-verb follows the sequence of operations applied by the computer so it's easier to read.

Re:Verb-Noun vs. Noun-Verb by jodrellblank on Wednesday October 16, 2019 @04:48PM (#21275444)
That's where I was going as well, LISP style and APL style claims "reads left to right" but having to build up a stack of buffered work which you can only unwind once you get to the end, is annoying and unhelpful and limiting.

But simply turning it around to cards.shuffle().deal(4) isn't a good answer, it's still the case that you can only put a small number of things together in a chain because it stops making sense. If the next move was to start the game, "cards.shuffle().deal(4).startgame('some-card-game')" does not make sense because starting the game is not something the cards do, but "start(deal(shuffle(cards), 4), 'some-card-game')" can make sense because start is a function which takes a board state and a game to start. It describes the world state, not the cards and their abilities.

That is, neither style is right, but a mixed style where both approaches are available and you can mix and match to be more expressive, works much better, IMO. Chunking a small number of things with prefix into one operation, or with postfix into one operation, but combining those chunks flexibly at a larger scale.

Re:Verb-Noun vs. Noun-Verb by cb504 on Wednesday October 16, 2019 @05:06PM (#21275703)
the main point was about auto-completion and usability and discoverability. fluent api for the win.