Wednesday, July 21, 2010

Design principles ( SOLID )

SOLID principles
( Object Oriented Designs )

S = Single Responsibility Principle
O = Opened Closed Principle
L = Liscov Substitution Principle
I = Interface Segregation Principle
D = Dependency Inversion Principle

You mush have Object Oriented Design because
# Of course, object oriented.
# Re-usable
# Can be changed with minimal effort.
# Can be extended without changing existing codes.

HERE ARE BASIC DEFINITION OF SOLID

1. Single Responsibility Principle



Single Responsibility Principle defines :

“THERE SHOULD NEVER BE MORE THAN ONE REASON FOR A CLASS TO CHANGE.”


2. Opened Closed Principle




Opened Closed Principle defines :

“SOFTWARE ENTITIES (CLASSES, MODULES, FUNCTIONS, ETC.) SHOULD BE OPEN FOR EXTENSION, BUT CLOSED FOR MODIFICATION.”   

3. Liscov Substitution Principle




Liscov Substitution Principle defines :

“SUBTYPES MUST BE SUBSTITUTABLE FOR THEIR BASE TYPES”


4 . Interface Segregation Principle




Interface Segregation Principle defines :

“CLIENTS SHOULD NOT BE FORCED TO DEPEND UPON INTERFACES THAT THEY DO NOT USE.”


5. Dependency Inversion Principle





Dependency Inversion Principle defines :

“HIGH LEVEL MODULES SHOULD NOT DEPEND UPON LOW LEVEL MODULES. RATHER, BOTH SHOULD DEPEND UPON ABSTRACTIONS.”


There are several kind of Object Oriented Principles such as ---

1. Composition over Inheritance : This says about favoring composition over inheritance.

2. Principle of least knowledge : This says the less your class knows, the better.

3. The Common Closure Principle : This says related classes should be package together

4. The Stable Abstractions Principle : This says the more stable a class is, the more it must consist of abstract class.
“Walking on water and developing software from a specification are easy if both are frozen.“ - Edward V. Berard
thanks

No comments: