Posted by David Haynes on 01/14/06 23:30
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-
Navigation:
[Reply to this message]
|