Ask HN: What's your biggest challenge in trying to learn functional programming?
- what's been your biggest challenge so far? - what has worked and what hasn't? - why did you decide to learn FP?
Thanks!
- what's been your biggest challenge so far? - what has worked and what hasn't? - why did you decide to learn FP?
Thanks!
The most difficult thing thus far has been that I haven’t seen where many of the more interesting FP concepts fit into my daily programming efforts. I am most frequently working on LOB applications, mobile apps, or backend APIs. It’s very much the world of take a model, do something to it, and return it. I know that it comes with practice, but often times the cool chaining and currying concepts, FP modifiers (except for map and a couple other simple functions) just don’t seem to apply when I think about the problems I’m trying to solve. The tutorials often lack any real-world examples, focusing more on math problems or “not real data” uses.
That being said, one of the biggest things that I have taken away is the idea that, given the same inputs a function should always return the same outputs, and be free of outside state. That has definitely helped me improve my coding.
I know what those are, but this is just not how I see the world, and forcing myself to think about code in those terms just isn't productive.
What worked: using FP composition / organization / abstraction patterns that often involve those same FP concepts but without cargo culting.
Non-hardcore FP has been very rewarding to me. With Scala, mixing FP and OOP patterns is a great way to get the best of both worlds.