SOLID principles
The principles we discussed in this chapter—abstraction, encapsulation, inheritance, and polymorphism– are the pillars of object-oriented programming. However, these are not the only principles that developers employ when doing object-oriented programming. There are many other principles but some that are worth mentioning at this point are the five known by the acronym SOLID. These were initially introduced by Robert C. Martin in 2000, in a paper called Design Principles and Design Patterns. The term SOLID was later coined by Michael Feathers:
- S stands for the Single responsibility principle that states that a module or a class should have a single responsibility, where responsibility is defined as a reason to change. When a class provides functionalities that may change at different times and for different reasons, it means those functionalities do not belong together and should be separated into different classes.
- O stands for the Open...