5 ms·
As a person heavily invested in OOP, is there any good reference (book preferably) about Functional Programming? I know there must be lots of resources, but fi
by edgarvaldes 7y ago
As a person heavily invested in OOP, is there any good reference (book preferably) about Functional Programming?
I know there must be lots of resources, but finding a good one can be difficult when you are new to a field.
- adt2bt 7y agoI've always liked Learn you a Haskell, but it's a trip to get through and you may need to re-read it a few times for things to stick. Another helpful one is Functional Javascript. It showed me a new, better, way to write my JS code. I found it can be easier on your mind when you pick it up almost like vim. First you learn how to move around with hjkl (perhaps a functional equivalent is using .map() and .filter() instead of for loops), then you navigate by lexical concepts with w, e, $, %, etc (maybe using .zip()), then build macros with @ (currying), etc. Each step you learn and use regularly helps when stretching your brain to pick up more. You definitely don't need to rewrite everything in a functional way to take advantage of it.
- thomasmeeks 7y agoTo be honest, I didn't really get the allure until I read "Programming Phoenix." Which isn't really a Functional Programming book. But, it does make clear some of the advantages of functional programming when working in the request/response cycle of your average web app. Picking up the other more abstract concepts had clear value to me after going through it, and so was much easier.
- ahuth 7y agoProgramming Elixir is a good one - https://pragprog.com/book/elixir/programming-elixir https://pragprog.com/book/elixir/programming-elixir. It's (obviously) about the Elixir programming language, but was a pretty good introduction to functional programming for me, as well. As was working through problems on https://exercism.io/ https://exercism.io/ in Elixir and Clojure.
- zinclozenge 7y agoThis was my introduction to functional programming. The nice things about Elixir for learning functional programming is that it's not nearly as complicated as haskell, feels more familiar, and dynamically typed. I'd recommend this book as it teaches how to think about solving things by writing recursive functions (Elixir/erlang has tail call optimization), pattern matching, etc. No need to learn the OTP concepts (genserver, supervisors, etc).
- t-writescode 7y agoSomething funny I’ve heard about Erlang, and so I assume Elixir is the same, is that the actor model is the perfect interpretation of OO, where even the messages themselves (often though of as methods in OO) are objects, too! So, perhaps in learning that, you’re learning a more perfect OO.
- dagw 7y agohttps://pragprog.com/book/swdddf/domain-modeling-made-functional https://pragprog.com/book/swdddf/domain-modeling-made-functi... is a great book to get started with. Unlike most books on FP it doesn't start with an academic or mathematical approach but rather focuses on how to use FP to make solving every day 'business' programming easier and less error prone.
- madhadron 7y agoI suggested this somewhere else, but Ullman's old book 'Elements of ML Programming' is still a truly excellent introduction, and Standard ML is a much less exotic language than Haskell for someone coming from the OOP world.