Creating maintainable systems using SOLID principles
SOLID is a reference to the top five principles of Object-Oriented Design (OOD):
- The Single Responsibility principle
- The Open-Closed principle
- The Liskov Substitution principle
- The Interface Segregation principle
- The Dependency Inversion principle
Following these principles will allow you to create systems that are robust, extensible, and maintainable. Honoring these principles prepares you well for working with patterns because many patterns are built on or reference these principles.
The Single Responsibility principle
Every method should do one thing. Every class should represent one thing. We call this idea the Single Responsibility Principle (SRP). If you have a method inside an object that does many things without invoking outside methods, your method is doing too much and runs the risk of becoming an example of the antipattern known as the god function. These are big, messy piles of inedible...