Chapter 1. What is functional programming?

This chapter covers

  • The benefits of functional programming
  • Problems with side effects
  • How referential transparency makes programs safer
  • Reasoning about programs with the substitution model
  • Making the most of abstraction

Not everybody agrees on a definition for functional programming (FP). In general terms, functional programming is a programming paradigm, and it’s about programming with functions. But this doesn’t explain the most important aspect: how FP is different from other paradigms, and what makes it a (potentially) better way to write programs. In his article “Why Functional Programming Matters,” published in 1990, John Hughes writes the following:

Functional programs contain no assignment ...

Get Functional Programming in Java: How functional techniques improve your Java programs now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.