14 Solving common problems functionally
- Using assertions
- Automatic retries for failing functions or effect applications
- Reading property files
- Adapting imperative libraries
- Converting imperative programs
- Repeating effects
You now have many tools that can make your life as a programmer easier by using safe programming techniques coming from the world of functional programming. But knowing the tools isn’t enough. To become efficient using functional techniques, you must make them second nature. You need to think functionally. Just as object-oriented (OO) programmers think in patterns, functional programmers do the same with functions.
When OO programmers have a problem to solve, they look for design patterns they can recognize and attempt to reduce the problem to a composition of patterns. Once they’ve done that, they need to implement the patterns and compose them.
Functional programmers do the same with functions with one difference: when they find that a function could be used to solve a problem, they don’t have to reimplement it. They can reuse it, because functions, unlike design patterns, are reusable code.