Home Tutorial Php Phpoop PHP Design Patterns

 
 

Share on Google+Share on Google+
PHP Design Patterns
Posted on: February 23, 2010 at 12:00 AM
Advertisement
In this tutorial we will study what is a design pattern and in the subsequent pages we will study about various design patterns supported by PHP. A design pattern is like a template which guides us to solve a problem. Design patterns are not finished design that can be transformed directly into code. In Object Oriented based design patterns we can get the interactions and relationships between classes or objects.

PHP Design Patterns:

A design pattern is like a template which guides us to solve a problem. Design patterns are not finished design that can be transformed directly into code. In Object Oriented based design patterns we can get the interactions and relationships between classes or objects.

It is not necessary that every software patterns are design patterns. Design patterns generally persists in the domain of modules.

Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides were introduced design patterns and this was foreword by Grady Booch. 

There are almost 23 patterns present and these are based on different categories like Creation patterns, Structural patterns, and Behavioral patterns.

Now we will study five common design patterns in PHP 5:

 

 

PHP Factory Method
It is very common problem that sometimes we need to change a little in our coding and subsequently we have to change so many places like in other class, function etc. It is called tight coupling. In this case factory pattern helps us a lot. In the current tutorial we will study about factory method and how to implement this in PHP.
 
PHP Singleton Method
In the current php tutorial we will study about singleton pattern of PHP, which is another type of designing pattern. Examples will help you understand in better way.
 
PHP Observer Method
In this pattern one object make itself observable and other objects observed it. The object which is observed is called subject. When the observable object changes it passes some message to the observer and the observer uses those message according to their need..
 
Advertisement

Related Tags for PHP Design Patterns:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: February 23, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com