Introduction
Classes, like objects and functions, are the fundamental building blocks from which we create programs. As programs grow, it becomes more difficult to efficiently and systematically define relationships between entities. When the relationships between data and functionality grow complicated, we can use classes and other objects to organize them. But what do we do when classes and objects proliferate?
Design patterns can be a helpful guide. Useful design patterns are refined from practical implementation. These patterns are intended to solve patterns of a given shape in predictable ways. When properly implemented, they form a contract of expected behaviors. This predictability and regularity (with other implementations of the pattern) assist in reasoning about code and a higher level of abstraction.
In this chapter, we'll see how common design patterns can be used as blueprints for organizing larger structures.