Implementing Design Patterns – The Functional Way
In Chapter 10, Ensuring Purity, we saw several functional techniques to solve different problems. However, programmers used to employing OOP may find that we have missed some well-known formulas and solutions often used in imperative coding. Since design patterns are well known, and programmers will likely already be aware of how they are applied in other languages, it’s important to look at how a functional implementation would be done.
In this chapter, we shall consider the solutions provided by design patterns that are common in OOP, to see their equivalent in FP. This will help you transition from OOP to a more functional approach and learn more about FP’s power and methods, by seeing alternative solutions to problems.
In particular, we will study the following topics:
- The concept of design patterns and what they apply to
- A few OOP standard patterns and what alternatives we have in FP if we...