Sunday, July 24, 2016

SOLID Principles

Is first five object oriented design (OOD) principle given by Robert C. Martin.

S – Single responsibility principle – A class should have one reason to change. Means a class must have only responsibilities related to it.

O – Open-closed principle – Extension should be preferred over modifications. Classes & functions should be open for extension but close for modifications (by sub classing & virtual functions).

L – Liskov substitution principle – Parent type should easily replace its child types (Polymorphism).

I – Interface segregation principle – Means, share only those functionality to clients whichever they want and introduce another more functionalities for new client without affecting old clients.

D – Dependency Inversion Principle – Depending on abstraction not on concretion.
High-level modules should not depend on low-level modules. Both should depend on abstractions.
Abstractions should not depend on details. Details should depend on abstractions. 

No comments:

Post a Comment