Chapter 1. Becoming functional

This chapter covers

  • Thinking in functional terms
  • Learning the what and why of functional programming
  • Understanding the principles of immutability and pure functions
  • Functional programming techniques and their impact on overall design

OO makes code understandable by encapsulating moving parts.

FP makes code understandable by minimizing moving parts.

Michael Feathers (Twitter)

If you’re reading this book, chances are you’re a JavaScript developer with a working knowledge of object-oriented or structured design, and you’re curious about functional programming. Perhaps you’ve tried to learn it before and haven’t been able to apply it successfully at work or on your personal projects. In either case, your main goal is to advance your development skills and improve the quality of your code. This book can help you accomplish that.

The rapid pace of web platforms, the evolution of browsers, and—most important—the demands of end users have all had a profound effect on the way we design web applications today. Users demand that web applications feel more like a native desktop or a mobile app with rich and responsive widgets. Naturally, these demands force JavaScript developers to think more broadly about the solution space and to adopt adequate programming paradigms and best practices that provide the best possible solutions.

1.1. Can functional programming help?

1.2. What is functional programming?

1.3. Benefits of functional programming

1.4. Summary