Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

DeveloperTutorials.com:
The Singleton Design Pattern for PHP
Aug 03, 2005 @ 10:59:36

On DeveloperTutorials.com there's a new tutorial dealing with one of the design patterns for applications as applied in PHP - the Singleton Pattern.

In software engineering, a design pattern is a general solution to a common problem in software design. A design pattern isn't a finished design that can be transformed directly into code, it is a description or template for how to solve a problem that can be used in many different situations.

One of these design patterns is called the Singleton. It's purpose can be described quite briefly as follows: "Ensure a class has only one instance and provide a global point of access to it."

It achieves this by only creating a new instance the first time it is referenced, and thereafter it simply returns the handle to the existing instance.

Hence the "single" in Singleton...and in this tutorial, they show you how to implement it quickly and easily - complete with code, explainations, and advantages/disadvantages of their methods.

tagged:

Link:


Trending Topics: