5 Lessons from Functional Programming in Scala, By Paul Chiusano and Runar Bjarnason

www.sandromaglione.com
7 min read
standard
5 key lessons from Functional Programming in Scala. Learn the core principles of Functional Programming and learn Functional coding.
Functional Programming in Scala by Paul Chiusano and Runar Bjarnason is one of the cornerstones for every functional developer. It demystifies Functional Programming. Step by step you learn what functional programming is and how to apply it in your day-to-day work. The definition of Functional Programming given by the book is eloquent:

Functional programming (FP) is a style of software development emphasizing functions that don't depend on program state. Functional code is easier to test and reuse, simpler to parallelize, and less prone to bugs than other code. Paul Chiusano and Runar Bjarnason

In this article, I am going to review the 5 key lessons I learned from the book. I believe these are core principles that will make you a better developer regardless of your programming language of choice.

Table Of Contents

1. Local reasoning in Functional Programming

You may have heard many claims about why you should use Functional Programming. Pure functions, immutability, composability. Yes, these are the principles of Functional Programming. They guide your code and make it more solid, scalable, and, well, functional.

Nonetheless, the main reason you should consider Functional Programming is Local Reasoning.

When you code using Functional Programming principles, you are making your code more complicated but less complex:

A Complex System has a lot of interconnected blocks. These blocks all depend on each other, they cannot be studied separately, and their behavior is hard to predict. This is what happens when you are working on a huge non-functional application. You are afraid to make any modification because you risk breaking other code somewhere else.

has a lot of interconnected blocks. These blocks all depend on each other, they cannot be studied separately, and their behavior is hard to predict. This is what happens when you are working on a huge non-functional application. You are afraid to make any modification because you risk breaking other code…
Read full article