1 Welcome to Grokking Simplicity

 
Image

In this chapter

  • Learn the definition of functional thinking.
  • Understand how this book is different from other books on functional programming.
  • Discover the primary distinction that functional programmers make when they look at code.
  • Decide whether this book is for you.

In this chapter, we will define functional thinking and how its major distinction helps working programmers build better software. We will also get an overview of the journey ahead through two major insights that functional programmers experience.

What is functional programming?

Programmers ask me all the time what functional programming (FP) is and what it’s good for. What FP is good for is difficult to explain because it is a general-purpose paradigm. It’s good for everything. We’ll see where it really shines in just a few pages.

Defining functional programming is difficult, too. Functional programming is a huge field. It’s used in both the software industry and in academia. However, most of what has been written about it is from academia.

Grokking Simplicity takes a different approach from the typical book about functional programming. It is decidedly about the industrial uses of functional programming. Everything in this book needs to be practical for working software engineers.

Image

You may come across definitions from other sources, and it’s important to understand how they relate to what we’re doing in this book. Here is a typical definition paraphrased from Wikipedia:

The problems with the definition for practical use

Problem 1: FP needs side effects

Problem 2: FP is good at side effects

Problem 3: FP is practical

The definition of FP confuses managers

We treat functional programming as a set of skills and concepts

Distinguishing actions, calculations, and data

Functional programmers distinguish code that matters when you call it

Functional programmers distinguish inert data from code that does work

Functional programmers see actions, calculations, and data

Step 1: The user marks a task as completed.

Step 2: The client sends a message to the server.

Step 3: The server receives the message.

Step 4: The server makes a change to its database.

Step 5: The server makes a decision of who to notify.**

Step 6: The server sends an email notification.**

The three categories of code in FP

sitemap