3 Apr 2016

SOLID Principles

SOLID

Single Responsibility Principle
       There should never be more than one reason for a class to change.

Open Closed Principle
       Module should be open for extension but closed for modification.
      Eg: For existing 10 algorithm, if I have to add 11th algorithm it should allow for extension.

Liskov Substitution Principle
    Functions which uses reference of base class, should be able to use objects of derived class without knowing them.
    Eg: Program generic Interface, and do not refer concrete classes.

Interface Segregation Principle
    Many client interface are better than one generic Interface.

Dependency Inversion Principle
High level modules should not depend on low level modules. Do not depend on many classes, depend on Interfaces or abstractions.
Both should depend on abstractions.
Abstractions should not depend on details.
Details should depend on details.
Program to interface, not to concrete classes.

0 comments:

Post a Comment