Overview of SOLID Principle

SOLID principles are the set of principles first given by Robert C. Martin. SOLID principles, as the name suggests. is a set of principles that allows building SOLID software system (in other words applications and application modules), if one implements software depending on this set of principles.

A SOLID software system means it allows building systems like the following:

  1. Easy to maintain
  2. Easy to extend
  3. Easy to understand
  4. Easy to implement
  5. Easy to explain

SOLID principles are related to the design and maintenance of software systems. Most developers mix SOLID principles with OOD principles and Design patterns. The following image removes the confusion of OOD principles and design patterns.

Note: This is my interpretation of how they are arranged.

So as in the image:
  1. OOD Principles (Abstraction, Encapsulation, Inheritance and Polymorphism).
  2. SOLID principle.
  3. Software Design Patterns (GOF patterns, Dependency injection and patterns).
  4. Martin Flower's Enterprise Application Architectures Pattern (additional but required).
  5. Domain Driven Design Architecture (additional but required).

S.O.L.I.D is an acronym for the following.

  1. Single Responsibility Principle

    The Single Responsibility Principle is related to the design of the software module, class or function that should perform only one task. So this principle is about creation.

    Single Responsibility Principle

    In Detail Read: Single Responsibility Principle

  2. Open/Close Principle

    The Open/Close Principle is applied after 1 (Single Responsibility Principle), again this principle is related to designing a module, class or function, but it is about closing something that already exists for modification, but opening the designed thing for extension, in other words extending the functionality. So this principle is about extension.

    Open Close Principle

    In Detail Read: Open/Close Principle

  3. Liskov Substitution Principle

    The Liskov Substitution Principle is related to substitution of a child instead of its parent. So principle is about relationship in other words inheritance.

    Liskov Substitution Principle

    Read in detail: Liskov Substitution Principle

  4. Interface Segregation Principle

    The Interface Segregation Principle is related to designing interfaces as one of the basic rules of designing. It depends on abstraction. The principle is about the design interface in such a way that the client of the interface does not force the implementation of the required things. So this principle is about efficient interface design.

    Interface Segregation Principle

    In Detail Read: Interface Segregation Principle

  5. Dependency Inversion Principle

    The Dependency Inversion Principle is related to designing decoupling modules and classes of software systems. This principle is most commonly applied after 4 (Interface Segregation principle) because the interface is one form of abstraction and this principle is related to the details (module/class) that should depend on abstraction and abstraction should not depend on detail. So this principle is about creating loosely-coupled systems.

    Dependency Inversion Principle

    Read in detail: Dependency Inversion Principle