Re: [PHP-PEAR] [drift] About function renaming

[email protected] (Chuck Hagenbuch)
Newsgroups php.pear
Message-ID <[email protected]>
Quoting "Stig S. Bakken" <[email protected]>:

> 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, <[email protected]>
"My intuitive grasp of math often leads me astray." -Me
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.