In this chapter, we learned about several patterns that can be quite useful in application design.
We started with the singleton type dispatch pattern. Using a command processor example, we successfully refactored the code from using if-then-else conditional statements to utilizing dynamic dispatch. We learned how to create new singleton types using the standard Val type or rolling our own parametric type.
Then, we switched gears and discussed how to implement automated testing effectively using the stubbing/mocking pattern. We took a simple use case of a credit approval process and experimented with a simple way to inject stubs using keyword arguments. We weren't very satisfied with the need to change the API for testing, so we leaned on the Mocking package for a more seamless approach. We then learned how to replace function calls with stubs and mocks in our...