We've previously discussed how we can use functions and operations on functions to organize our code. We can't ignore, however, the prevalent paradigm for software design of the past few decades—object-oriented programming (OOP). Can OOP work with functional programming? Is there any compatibility between the two, or are they completely disjointed?
It turns out that we can easily convert between classes and functions. I learned through my friend and mentor, J.B. Rainsberger, that classes are nothing more than a set of partially applied, cohesive pure functions. In other words, we can use classes as a convenient location to group cohesive functions together. But, in order to do so, we need to understand the high cohesion principle and how to transform functions into classes and vice versa.
The following topics will be covered in...