This topic will likely be turned into a blog on my own domain at some point. I want to share my thoughts with you here first, though.
Functional programming (FP for short) is a paradigm, alternatives are Object Oriented Programming or Procedural programming. See Wikipedia for a more in-depth introduction:
I have a background in maths. So learning about Professor Frisby’s book at
(Code on GitHub GitHub - MostlyAdequate/mostly-adequate-guide: Mostly adequate guide to FP (in javascript) ) changed my perspective on how I want to write code.
Now, there are use cases for each paradigm. In my experience with building web frontends I often have to turn state into UI. Something I feel Functional Programming is good at.
Breaking logic up into small functions makes it easy to test them (gaining confidence that they work as expected) while also allow for composition. Now I want to avoid the dreaded M-word at which point many will turn off.
But I feel like taking some concepts of FP can help improve the code. For example, I really enjoy Pure Functions (output only depends on input. No side effects such as logging, HTTP requests or database queries).
There is the option to take it to the extreme, but I am fine with multi-paradigm languages (such as JavaScript and Python) that allow me to take what I need.
What are your thoughts on FP?