PhpRiot
News Archive
PhpRiot Newsletter
Your Email Address:

More information

PHPEasy.co.uk: Design Patterns - The Singleton Pattern

Note: This article was originally published at PHPDeveloper on 18 April 4080.
PHPDeveloper

PHPEasy.co.uk has a new tutorial posted introducing one of the most common (and often misused) design patterns out there - the Singleton pattern.

In this first tutorial in the design pattern series we are going to investigate and implement the singleton design pattern. [...] A design pattern is a common solution to a given problem, problems in programming tend to recur and we often find ourselves trying to solve the same issues over and over. The common techniques that provide solutions to these problems can be referred to as design patterns.

He talks about some of the most common uses for the Singleton pattern (mainly replacing a global variable) and includes an example of using one to fetch a database object.