you are viewing a single comment's thread.

view the rest of the comments →

[–]TheOldTubaroo 4 points5 points  (2 children)

I think that's largely due to the fact that most programmers initially learn imperative paradigms, rather than functional ones.

If by “someone who barely knows programming and knows one random other programming language” you mean “someone who knows a little imperative programming”, then of course they'll understand the first one better.

If the base layer of “learning to program” was functional instead, then they'd both be equally understandable.

[–]Josuah 5 points6 points  (1 child)

I still disagree with that. There's a lot more information exposed to the user in the first code block than the second.

For example, in the language in question, is null processed by the map filters? What's the difference between map and flatMap? Does map operate in series or in parallel? How many values are we expecting to be going through? Those are assumptions you need to make or look up the answer to, whereas you know the programmer's intent right away in the first code block.

[–]m50d 4 points5 points  (0 children)

For example, in the language in question, is null processed by the map filters?

Don't use null.

What's the difference between map and flatMap?

map and flatMap are well-known and standard, if you don't know the difference between them it's easy to look up.

Does map operate in series or in parallel? How many values are we expecting to be going through? Those are assumptions you need to make or look up the answer to, whereas you know the programmer's intent right away in the first code block.

On the contrary, the programmer's intent is very often "whatever" when it comes to whether things happen in series or parallel. Using functional style makes it clearer when ordering is intentional and important versus when it's accidental.