Learning the Four Fundamental Pillars
Now that you understand what object-oriented design and Object-Oriented Programming (OOP) are, and what the approach we are taking toward them is, it is time to present the four fundamental pillars that allow us to design and implement OOP solutions to you.
In this chapter, we will understand why abstraction is the very core of design and how to create good abstractions so you can focus on the class goal instead of wasting time and energy thinking about implementation details.
We will also see how encapsulation walks hand-in-hand with abstraction by preventing user classes from accessing implementation details on the designed class. Furthermore, we’ll see why we should also prevent user classes from directly making mutations on the class.
Then, we will talk about inheritance, a topic that causes the most heated debates about OOP. Inheritance is both OOP’s core feature and its nemesis unless you understand its underlying principles...