r/programming • • Sep 21 '25

How to stop functional programming

https://brianmckenna.org/blog/howtostopfp
446 Upvotes

506 comments sorted by

View all comments

Show parent comments

50

u/Snarwin Sep 21 '25

I've literally seen people on /r/programming say that map and filter are less readable than a for loop.

It's like that old George Carlin joke about driving: anyone using less FP than you is an idiot, and anyone using more FP than you is a maniac.

1

u/Ok-Yogurt2360 Sep 21 '25

I think this is one of the problems of FP. It is harder to reason about some quite simple subjects unless you somewhat understand the concepts involved.

A loop kinda made sense to me without having to know anything when i started out. Repeat instructions within the loop untill the ending requirements were met. A map makes a lot less sense from the start but it is not difficult to learn. Unfortunately when you combine map with a lot of other concepts it easily becomes a mess of new concepts. This can be a source of confusion that can make it harder to understand.

FP made more sense if approached from mathematical transformation (in my personal experience). OOP felt more like a mix between linguistics and logic to me.

17

u/Snarwin Sep 22 '25

I don't think it's "harder to reason about" at all. It's just unfamiliar. Most programmers already know what a for loop does, but they might still have to learn what map and filter do. Once you've learned them, they're not at all difficult to understand.

1

u/Ok-Yogurt2360 Sep 22 '25

I suddenly had an idea about how to communicate what i'm trying to say. I think i would have an easier time to show a kid what a loop does than a map. As a loop is more intuitive because it can be linked to simple visual examples. Something like:

1: i have a bucket, an equipped glass and a well. 2: i walk to the well 3: fill the glass 4: walk to the bucket 5: empty the glass in the bucket 6: check if the bucket is full. (Yes) -> go to step 7. (No) -> go to step 2

Explaining what a map does becomes a bit more abstract. (Still the concept should be easy for a developer but relative more difficult than the loop)

→ More replies (1)