Pranay Rana: SOLID Principle In Detail

Monday, July 13, 2015

SOLID Principle In Detail

SOLID principles are the set of principle fist given by Robert.C.Martin. SOLID principle as name given its set of principle that allows building SOLID software system (i.e. Application, Application Module), if one implement software according to this set of principle.

SOLID software system means its allows to build system that is
  • Easy to maintain
  • Easy to extend
  • Easy to understand
  • Easy to implement
  • Easy to explain
SOLID principles are related with the design and maintenance of software system. Most of the developer mix SOLID principles with OOD principles and Design patterns. Below image that removes confusion of OOD principles and Design patterns
Note: This is my interpretation of the arranging thigs.

So as per image

  1. OOD Principle (Abstraction, Encapsulation, Inheritance, Polymorphism)
  2. SOLID principle
  3. Software Design Patterns (GOF patterns, Dependency injection & 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 acronym for

  1. Single Responsibility Principle

    Principle is related to Designing software module, class or function that should perform only one task. So this principle is about Creation.

    In Detail Read : Single Responsibility Principle In Detail

  2. Open/Close Principle

    Principle is applied after 1 (Single Responsibility Principle), again this principle is related to Designing module, class or function. But it about closing already designed thing for modification but opening designed thing for extension i.e. extending functionality. So this principle is about extension.

    In Detail Read : Open Closed Principle
  3. Liskov Substitution Principle

    Principle is related to substitution of child in place of its parent. So principle is about relationship i.e. inheritance.

    In Detail Read : Liskov Substitution Principle
  4. Interface Segregation Principle

    Principle is related to designing of interfaces as one of the basic rules of designing says depends on abstraction. Principle is about design interface such a way, so that client of interface not force to implement not required things. So principle is about efficient interface design.

    In Detail Read : Interface Segregation Principle

  5. Dependency Inversion Principle

    Principle is related to designing decoupling modules, classes of software system. This principle mostly applied after 4 (Interface Segregation principle) because interface are one form of abstraction and this principle is related to Details (module/class) should depend on abstraction, and abstraction should not depend on detail. So this principle is about creating loosely coupled system.

    In Detail Read : Dependency Inversion Principle

No comments:

Post a Comment