You should study functional programming to become a better programmer

It’s likely that you’ve encountered functional programming as a way of describing certain kinds of programs, techniques, libraries, or programming languages, but if you haven’t already dug in and seriously attempted to understand these things then you might feel a lot of hesitation.

In some communities—for instance, the React community in frontend development—functional ideas are taking center stage and shaping expectations of what someone in that community ought to know. In others, functional techniques are available, but suggested only for special circumstances such as the funtools module in Python. Finally, there are today rapidly growing groups which are heavily invested in these techniques such as the Scala, Haskell, Swift, and Elixir communities.

It’s perfectly plausible to write great programs and create great products without ever learning functional techniques, but as these techniques become more popular and widespread it’s easy to feel like you should be learning more about them. Is it really worth the investment?

One of the key skills of a professional developer is the ability to fluently describe a solution to a technical problem in simple terms. To do this we use tools of language and a programmer’s skill with these tools can be a multiplier to their effectiveness as a team member, creator, and problem solver.

You should study functional programming to become a better programmer. In particular, functional programming as a discipline stresses an understanding of how languages themselves work as tools for problem solving. Studying it will help you test fundamental assumptions you hold about the entire practice of development. Becoming familiar with those assumptions will help you make better technical tradeoffs.

For instance, one of the very first things you’re likely to encounter in a functionally-styled codebase is the serious and consistent avoidance of mutation. On the face of it, this sounds ridiculous—computers operate through mutation of memory and avoiding that will obfuscate algorithms and harm performance!

And this is exactly the point. You can make that judgement and may even be right in that judgement throughout your entire career, but if you appreciate the advantages of working without mutation then you will make that tradeoff with greater confidence and finesse.

Functional programming is a style of formal thinking which has been developed for about a century. You don’t need to study it, and after studying it you might continue to make the same technical decisions you did before you began. But, if you do then you’ll make them for better reasons and that will make you a better programmer.

One thought on “You should study functional programming to become a better programmer

Comments are closed.