Monday 9 November 2015

SOLID Pribciples


SOLID Principles:



SOLID are five basic principles whichhelp to create good software architecture. SOLID is an acronym where:-
  • S stands for SRP (Single responsibility principle )
  • O stands for OCP (Open closed principle)
  • L stands for LSP (Liskov substitution principle)
  • I stands for ISP ( Interface segregation principle)
  • D stands for DIP ( Dependency inversion principle)


SRP
A class should have only a single responsibility. Only one potential change in the software's specification should be able to affect the specification of the class. 

OCP

Software should be open for extension, but closed for modification. 

LSP
Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program 

 ISP
No client should be forced to depend on methods it does not use.
Many client-specific interfaces are better than one general-purpose interface.

 DIP
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