Re: Re: OOP question

From: Date: Tue, 30 Aug 2005 22:02:23 +0000
Subject: Re: Re: OOP question
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-39646@lists.php.net to get a copy of this message
Ammar Ibrahim wrote:
Lukas Smith wrote:
Ammar Ibrahim wrote:
Does it make sense to have a factory of singlton objects? I think it does, does such thing exist in PEAR? Which packages?
not sure what you mean .. are you asking if pear packages are using the singleton pattern? if that was the question: yes .. have a look at Log, LiveUser, MDB2 regards, Lukas
No, Now both Factory and Singleton are creational Design Patterns( They affect how objects are created ). Does it make sense to combine them together, say e.g. $object = Log::SingletonFactory( 'Database' ); the factory is clear in the previous example, but this also ensure that all subsequent calls will return reference to the first object created.
I was under the impression a Singleton always implied a Factory. Anyways .. LiveUser::singleton() returns an existing instance or calls factory() to create a new instance if none was found. regards, Lukas

« previous php.pear.dev (#39646) next »