4 ms·
Most people are taught from day 1 to code in some combo of imperative and OOP styles. The issue is not that FP is hard to learn. The issue is that most people
by jghn 5y ago
Most people are taught from day 1 to code in some combo of imperative and OOP styles.
The issue is not that FP is hard to learn. The issue is that most people start off from a much lower baseline knowledge-wise than they will when learning a new imperative and/or OOP language, framework, etc.
- moralestapia 5y agoI was going to comment on a similar line. I come from the OOP school and have done 10s-100s(?) of C/C++ projects, which I like, btw. But when I discovered FP it was an eye opener, the breadth of things that became possible/tractable is great, even my OOP programs became much better because of it. I think that the OOP curriculum is actually a regression, and would recommend anyone who is just starting out to try out FP first.
- eightysixfour 5y agoAs someone who only dabbles in code, I’m very interested in starting FP first, but I find that the beginner tutorials mostly assume previous programming knowledge/skills, and the communities aren’t really geared towards folks who don’t have backgrounds from other areas. It is certainly possible I’m not looking in the right place for the right thing, but it should probably be an area of improvement for those communities in the future IMO.
- blagovest 5y agoHey! I am writing an ebook about high-level programming concepts that starts off with a FP view point and builds on top of it. If that sounds interesting, I'd love to share (I am eventually going to sell it but I am fine giving away drafts)
- eightysixfour 5y agoAbsolutely, would love to take a look.
- blagovest 5y agolet me know how i can contact you
- Twisol 5y agoYou might like "How to Design Programs": http://htdp.org/ http://htdp.org/ It appears to exclusively work with the usual FP understanding of computation as reduction (simplification of an expression), avoiding all named mutable state. This is (in my opinion) the most important and fundamental difference between functional and imperative, and is something you miss if you try to learn FP in, say, JavaScript. It also doesn't seem to assume any prior experience with programming. The last chapter even has a section specifically directed at students who aren't computer scientists or software developers.
- srcreigh 5y agoThe 1st year computer science programming class at Waterloo is based on the 1st edition of this book. (Not sure why not the 2nd edition--the waterloo website says so. [1]) The authors of this book are some of the major folks behind the Racket programming language. Mattias Felleisen, Matthew Flatt, Robert Findler, Shriram Krishnamurthi. You might recognize Shriram Krishnamurthi's name in the credits to PG's guide to Bel too [1] I didn't really use this book much directly - when I took that class in 2012, I mostly learned via the lectures, lecture slides, and doing via the assignments. The book is probably sufficient and you can probably talk to other people about it via Racket subreddit, IRC, etc [1]: https://student.cs.uwaterloo.ca/~cs135/cc/textbook/ https://student.cs.uwaterloo.ca/~cs135/cc/textbook/ [2]: https://sep.yimg.com/ty/cdn/paulgraham/bellanguage.txt?t=1595850613& https://sep.yimg.com/ty/cdn/paulgraham/bellanguage.txt?t=159...
- moralestapia 5y agoYeah I agree with you in that there's definitely a steep curve for newcomers. Some work on that is needed, but it's coming along, take @blagovest's comment as an example. As with anything in life, just don't give up. Everything sucks till it's finished :D
- donglover69 5y agoExactly. I came from a math background and only ever used Wolfram Mathematica for programming, and naturally used functional programming. Later on I tried to learn imperative programming and it boggled my mind. The idea of changing a state over and over seemed so janky to me.
- dboreham 5y agoThis is an oft-repeated canard. The fact is that "OOP/Imperative" happens to align with how the human brain works, and how to a large extent reality works. Some aspects of FP also align with reality and mental processes (e.g. pure functions, comprehensions), but others do not (e.g. closures, monads, lambdas). I think FP advocates (I'd count myself as one, sometimes) like to gloss over this aspect and instead blame the student for being too stupid, or for having been indoctrinated in the dark side too much. FP I believe would be better received without the smugness surrounding "you're too dumb or too much of a dinosaur to understand". Be more like Dave Farley.
- donglover69 5y agoI disagree, I don't think Imperative aligns with the human brain. Humans have thought thru problems for millenia before computers existed. For a 1700s mathamatician to solve a problem in grueling, iterative steps that loop and change a state would be seen as a boneheaded caveman method. Pure functions were the norm of elegance in the olden days of famous polymaths. I didn't grow up with access to any computer, but I did a lot of mathematics, so going from that to Imperative thinking was super jarring and not natural at all.