Why SOLID Principles


  1. When software grows, it becomes rigid, fragile, immobile, and viscous. This needs to be prevented.
  2. broad goal of the SOLID principles is to reduce dependencies so that engineers change one area of software without impacting others.
  3. Also, make designs easier to understand, maintain, and extend
  4. And, build adaptive, effective, and agile software.

What are SOLID Principles


  • popular set of design principles that are used in object-oriented software development
  • developed by Robert C. Martin in a 2000 essay, “Design Principles and Design Patterns
  1. S: Single Responsibility Principle
    => “A class should have one and only one reason to change, meaning that a class should have only one job.”
  2. O: Open-Closed Principle
    => “Objects or entities should be open for extension but closed for modification.
    => This means that a class should be extendable without modifying the class itself.
  3. L: Liskov Substitution Principle
    => “Let q(x) be a property provable about objects of x of type T. Then q(y) should be provable for objects y of type S where S is a subtype of T.
  4. I: Interface Segregation Principle
    => “A client should never be forced to implement an interface that it doesn’t use, or clients shouldn’t be forced to depend on methods they do not use.”
  5. D: Dependency Inversion Principle
    => “Entities must depend on abstractions, not on concretions. It states that the high-level module must not depend on the low-level module, but they should depend on abstractions.”