Re: general questions
| From: | Markus Fischer | Date: | Thu, 29 Nov 2001 09:11:47 +0000 |
| Subject: | Re: general questions | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-3180@lists.php.net to get a copy of this message | ||
On Thu, Nov 29, 2001 at 01:40:41AM +0100, Lukas Smith wrote :
> I guess you are right ... so a factory is not supposed to reside in side
> the class it is "producing" for? Why?
In fact, 'factory' is just a function which gets a parameter
and depending on this it returns an object. Because all the
classes accessing the different databases support by PHP
share the same interface (all methods are named the same) you
won't notice much difference at first wether you get back a
myself or an oracle object.
It could also be a standalone function not being part of some
class but the idea is also not to pollute the global
namespace but keep things within their respective home
(looking forward to ZE2 which supports "something like"
namespaces, static class properties and class constants).
And, residing the factory function in the class it is
producing for doesn't reallt work out because it isn't
producing just an object for this class but for any kind of
appropriate database class when using PEAR::DB.
- Markus
--
Please always Cc to me when replying to me on the lists.