In Chapter 3, Starting Out with Functions – A Core Concept, we considered functions as the key elements in Functional Programming (FP), went into detail about arrow functions, and introduced some concepts, such as injection, callbacks, polyfilling, and stubbing. In this chapter, we'll have the opportunity to revisit or apply some of those ideas. We will also do the following:
- Consider the notion of purity, and why we should care about pure functions—and impure functions as well!
- Examine the concept of referential transparency.
- Recognize the problems implied by side effects.
- Show some advantages of pure functions.
- Describe the main reasons behind impure functions.
- Find ways to minimize the number of impure functions.
- Focus on ways of testing both pure and impure functions.