In the previous chapter, object-oriented programming (OOP) was discussed in preparation for exploring different patterns. As many patterns rely on concepts in OOP, it is important to introduce and/or revisit these concepts. Inheritance between classes allows us to define an is-a-type-of relationship. This provides a higher degree of abstraction. For example, with inheritance it is possible to perform comparisons such as a cat is a type of animal and a dog is a type of animal. Encapsulation provides a way of controlling the visibility and access of details of a class. Polymorphism provides the ability to handle different objects using the same interface. With OOP, a higher level of abstraction can be achieved, providing a more manageable and understandable way to deal with large solutions.
This chapter catalogs and introduces different...