News Feed
Sections




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

PHP-Tip-a-Day:
PHP Tutorial The Legend of the Singleton
June 13, 2012 @ 09:02:36

Following his recent allegory about the Factory pattern (as described in story form) Greg Bulmash has posted the Legend of the Singleton to help with your understanding this pattern.

The Singleton pattern provides an interface to let your application always pull out the same object (or make a new one if it needs to).

His legend talks about kings, mythological data sources and the overloading of multiple "hoses" (connections) to it. Also included is a code example showing a simple database class that includes a "getInstance" method acting as the Singleton to return either a new or the (same) current instance.

0 comments voice your opinion now!
legend story singleton designpattern


blog comments powered by Disqus

Similar Posts

DevShed.com: The Singleton and Factory Patterns in PHP - Building a Form Generator Class

PHP-Tip-a-Day: PHP Tutorial: The Legend of the Singleton

PHPMaster.com: Patterns for Flexible View Handling, Part 1 - Working with Composites

Community News: ABCPHP.com (Digg-Like PHP News Source)

Zend Developer Zone: PHP in Action - Chapter 7, Design Patterns. Part - III


Community Events





Don't see your event here?
Let us know!


language library interview configure laravel threedevsandamaybe project wordpress developer application podcast bugfix framework list api release code community series introduction

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework