Programmers often hit code they are afraid to change. By extracting pure functions, using currying and composition, and taking advantage of the compiler, you can refactor existing code in a safer manner. We'll see an example of refactoring through pure functions, and then we'll look at a few design patterns, how they are implemented in functional programming, and how to use them in your refactoring.
The following topics will be covered in this chapter:
- How to think about legacy code
- How to use the compiler and pure functions to identify and separate dependencies
- How to extract lambdas from any piece of code
- How to remove duplication between lambdas using currying and composition, and group them into classes
- How to implement a few design patterns (strategy, command, and dependency injection) using functions
- How to use design...