Sunday, February 14, 2010

PHP Design Patterns

Design pattern is nothing but how a civil engineer planed before start constructing any building i.e where a kitchen is, and how it will be, where temple room, where dining hall etc., In a software engineering design pattern is nothing but a blueprint for your software to avoid tight coupling of modules means when you modify some code in one module which doesn't take effect on other modules. The most usefull and common design patterns are

Sigleton pattern: Used to restrict instantiation of a class to one object only. The real time use of this pattern is connection to database is opened only once.

Factory pattern: Used to implement loosecoupled modules.

Observer pattern: Used to maintain all dependents and notifies them automatically when any change made