4 ms·
Ask HN: Why Learn Functional Programming
What are some reasons to learn functional programming. I have tried learning it but it gets complicated understand few concepts.
- CLPadvocate 6y agoactually, this IS the point of learning FP. it's a different way of thinking about programming and it offers you a new way (often a more elegant) of doing things. it's usually worth the effort. writing code in a functional way (even without a functional programming language) simplifies testing, often improves program stability and robustness. the more side-effect-free or pure blocks you have in your code, the easier you can build a composable or a concurrent program. basically, most of the principles of good software development (SOLID, DRY, KISS, ...) are native to FP.
- gjvc 6y agoI started watching the SICP video series on YouTube last year. Just the substitution model exemplified in the Scheme programs in the first few lectures has had a big effect on how I write Python for the $DAYJOB. Probably the most fascinating thing to me about programming is being able to learn a new approach and apply it in different languages or contexts. Note to OP -- watch the SICP video series on YouTube here https://www.youtube.com/playlist?list=PLB63C06FAF154F047 https://www.youtube.com/playlist?list=PLB63C06FAF154F047. Get the book and work at it. It's great.
- CLPadvocate 6y agoit's a great book and the video series is also very good. definitely a good start for FP and also for software engineering in general. coming from a C/Java background, my earlier Python code looks absolutely like a typical imperative/OOP mixture and now every time I look at it I see parts that can be rewritten in a much cleaner, simpler, FP-like style. it's really one of the paradigms that changes the mind in some way.
- mraza007 6y agoHey thanks for sharing that link I’ll definitely check it out
- lalo2302 6y agoWhy I think FP is getting popular: * It's old as hell which means is battle proven * Before it was hard to understand since everything pointed to look at it with a "mathematical view" which not every developer has. Now there are more tutorials and "Blog posts" * New technologies emerged which follow the pattern with familiar syntax and great tooling. Right now why should you? I'd say why not? If you already know OOP, FP can give you more ways on think about problems and solutions. Plus, it can give you a competitive advantage over other developers. It is definitely not a hammer which can nail down everything, but it's a good tool to have around.
- bensherman228 6y agofunctional programming is a catch-all term for a way of writing code that is focused on composing pure functions, actually using the innovations in type systems made in the last few decades, and overall being awesome. This one also gives such advantages: the ability to manage complexity with abstractions, more safe, reliable, composable code, better maintainability I would advise you to read this article - https://serokell.io/blog/introduction-to-functional-programming https://serokell.io/blog/introduction-to-functional-programm..., this article also has links to other useful topics that relate to this topic.