May 21, 2013

SOLID Principles




What is S.O.L.I.D.? 
S.O.L.I.D. is a collection of best-practice, object-oriented design principles which can be applied to your design, allowing you to accomplish various desirable goals such as loose-coupling, 
higher maintainability, intuitive location of interesting code, etc. S.O.L.I.D. is an acronym for the following principles:

SRP: Single Responsibility Principle
THERE SHOULD NEVER BE MORE THAN ONE REASON FOR A CLASS TO CHANGE.
OCP: Open Closed Principle
SOFTWARE ENTITIES (CLASSES, MODULES, FUNCTIONS, ETC.) SHOULD BE OPEN FOR EXTENSION BUT CLOSED FOR MODIFICATION. 
LSP: Liskov Substitution Principle
FUNCTIONS THAT USE ... REFERENCES TO BASE CLASSES MUST BE ABLE TO USE OBJECTS OF DERIVED CLASSES WITHOUT KNOWING IT.
ISP: Interface Segregation Principle
CLIENTS SHOULD NOT BE FORCED TO DEPEND UPON INTERFACES THAT THEY DO NOT USE
DIP: Dependency Inversion Principle
A. HIGH LEVEL MODULES SHOULD NOT DEPEND UPON LOW LEVEL MODULES. BOTH SHOULD DEPEND UPON ABSTRACTIONS
B. ABSTRACTIONS SHOULD NOT DEPEND UPON DETAILS. DETAILS SHOULD DEPEND UPON ABSTRACTIONS



No comments:

Post a Comment