3 ms·
> Assignment is just one tiny piece of learning how to program, and is almost never a pain point after a small amount of instruction. The issue isn't assignmen
by still_grokking 3y ago
> Assignment is just one tiny piece of learning how to program, and is almost never a pain point after a small amount of instruction.
The issue isn't assignment. You have also assignment even in the most pure FP languages.
The issue is mutation!
> Imperative programming is easier to learn because you simply write out the steps that you want the computer to take, and the computer takes them.
No, that's not easy given every step can change the whole world around and you need to track all the changes in your head.
That becomes very hard to follow even after only a few steps. (That's why imperative programs are always so buggy.)
FP code, which usually eschews mutation, is much simpler to follow as you can look at any "step" in isolation. No hidden "change the world" side-effects everywhere.
> FP requires much much more abstract thinking that is often difficult for newcomers to grasp.
No it doesn't. At least as long as you don't go nuts like e. g. Haskell.
At the core FP is basically the same trivial concept taught to children in elementary school: If you have some expression you can mechanically substitute following occurrences which the value assigned to that expression. That's all.
> The main exception that I see is when someone who has a very deep mathematics education.
Like every child that attended math classes for many years. In school people are trained for a very long time in exactly the way of reasoning you need to write FP code.
On the other hand you need to teach those people imperative programming form the ground up, including mayor mental shifts around all kinds of concepts they were taught previously. Only after this kind of brainwashing people start "to get" imperative programing…
> Almost everyone else seems to grasp imperative programming easier.
No. Quite the opposite.
https://cseducators.stackexchange.com/questions/342/what-makes-imperative-programming-easier-or-harder-to-learn https://cseducators.stackexchange.com/questions/342/what-mak...
https://stackoverflow.com/questions/778461/should-functional-programming-be-taught-before-imperative-programming https://stackoverflow.com/questions/778461/should-functional...
Just go out and talk to some programming instructors… Everybody will tell you the same.
Only people whos brains are already burned by imperative programming think it's easier. For everybody else it's the opposite. Which is perfectly logical as the FP way of thinking is what they practiced for many many years before, in math in school.
- whateverman23 3y agoEven on the top answer on one of your own links: "In spite of what this all sounds like, I'm not suggesting that functional programming is necessarily easier" My experience is that of a TA and a tutor. Granted, it's hard to find people who aren't tainted by imperative programming thinking these days, unless you're starting on the true ground floor, which I admittedly rarely do.
- brandonspark 3y agoThis is precisely how I teach it. I couldn't have phrased it better myself.
- intelVISA 3y agoThe hardest part of guiding somebody to the FP melange is undoing all the damage wrought by the other, lesser, paradigms.
- worrycue 3y ago>> Imperative programming is easier to learn because you simply write out the steps that you want the computer to take, and the computer takes them. > No, that's not easy given every step can change the whole world around and you need to track all the changes in your head. Learning and using are 2 separate things. FP is supposedly easier to use in the long run but it’s definitely harder to pick up. Imperative is the opposite since it’s analogous to writing out a list of things you want the computer to do - a concept even the uneducated can understand.