Re: [drift] About function renaming
| From: | Chuck Hagenbuch | Date: | Thu, 15 Feb 2001 15:20:38 +0000 |
| Subject: | Re: [drift] About function renaming | ||
| Groups: | php.pear | ||
| Request: | Send a blank email to php-pear+get-1356@lists.php.net to get a copy of this message | ||
Quoting "Stig S. Bakken" <ssb@fast.no>:
> There's one problem with this: the DB factory method doesn't know how to
> (and IMHO shouldn't know how to) capitalize the driver name, so I want
> to make an exception for DB, keeping it all lowercase like today.
> Nobody should be using the DB backend classes directly anyway unless
> they know what they are doing.
If we're going to make an exception, then we should make an exception for
anything that could have a factory method, not just DB. Like the Mail
subclasses. But I wrote the logic for finding the subclass into Mail::factory
(); it's not that complex. Part of the _point_ of a factory method is that you
don't need to know all of the details about the object you're getting back, so
I'd argue that knowing how to find the proper subclass is something that the
factory method could know.
And who are we to say what kinds of classes ought to have factory methods?
Exceptions are a slippery slope; once you start making them it becomes easier
and easier to justify more, and harder and harder to keep anything simple and
standard. So I think either we say that subclasses are lowercased, or we make
the factory methods smarter. I vote for the latter.
-chuck
--
Charles Hagenbuch, <chuck@horde.org>
"My intuitive grasp of math often leads me astray." -Me