You are here: Re: The Singleton Pattern in PHP 5 « PHP Programming Language « IT news, forums, messages
Re: The Singleton Pattern in PHP 5

Posted by FluffyCat on 01/15/06 06:01

On Sat, 14 Jan 2006 16:30:49 -0500, David Haynes
<david.haynes2@sympatico.ca> wrote:

>Gordon Burditt wrote:
>>> To add to my growing library of Design Patterns in PHP 5 I have
>>> written what I think is a good example of the Singleton Pattern.
>>>
>>> http://www.fluffycat.com/PHP-Design-Patterns/Singleton/
>>>
>>> In the classic singleton pattern an object will distribute one and
>>> only one instance of itself. This can be useful for the sharing of
>>> resources such as a single db or network connection.
>>
>> Why would one assume that there is only one instance of a database
>> connection or only one network connection? Isn't that almost as
>> bad as assuming that *THE ONLY* user presses *THE ONLY* key on
>> *THE ONLY* keyboard with *THE ONLY* finger?
>>
>> Gordon L. Burditt
>>
>Oh you're gonna hate yourself in the morning... ;-)
>
>The classic database connection singleton is to a connection pool not a
>single connection.
>
>-david-


Quite right, foolish of me to go out on a limb and get so darn and
unnecessarily specific.

The singleton pattern is (as described in GoF) "Ensure a class has
only one instance, and provide a global point of access to it".

Why you would or would not want such a thing I'll leave up to you.

-Larry Truett

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация