Thursday, December 11, 2008

Object Oriented Design principles

There is much hype about the design patterns in recent years and every one want to know design patterns or pretend to be experts in that. But most of them are not aware of the Object Oriented Design principles which are the base of any object oriented design. Design patterns provides a solution to most of the recurring design problems and basically does this by implementing good OO design principles. It is infact meaning less to go for design pattens before trying to understand the design principles. Design patterns basically leads you to apply good design priciples to solve your problem. These are the five basic design principles for object oriented class design .
  1. The Single Responsibility Principle(SRP)-A class should have one, and only one, reason to change.
  2. The Open Closed Principle (OCP)-You should be able to extend a classes behavior, without modifying it.
  3. The Liskov Substitution Principle(LSP) -Derived classes must be substitutable for their base classes.
  4. The Dependency Inversion Principle (DIP)-Depend on abstractions, not on concrete classes.
  5. The Interface Segregation Principle(ISP) -Make fine grained interfaces that are client specific.

Apart from these there are 6 more principles about package cohesion and coupling betwean packages.Provided below some links in the reference section to learn more about them

Reference

Object mentor

OO Design principles

oodesign.com

ootips.org

No comments:

Post a Comment