Re: CS discussion
| From: | Jon Parise | Date: | Tue, 15 Jul 2003 20:10:35 +0000 |
| Subject: | Re: CS discussion | ||
| References: | 1 | Groups: | php.pear.qa |
| Request: | Send a blank email to pear-qa+get-61@lists.php.net to get a copy of this message | ||
On Tue, Jul 15, 2003 at 01:45:38PM +0200, Lukas Smith wrote:
> 2) method naming
> here are a few suggestions:
>
> factory() (instead of connect() or create())
> singleton() (instead of getInstanceOf())
> connect() (instead of open())
> disconnect() (instead of close() or quite())
I think mandating method names is being too strict. Most developers
are savvy enough to use complementary pairs of methods such as open()
and close() or connect() and disconnect(). Part of designing a class
is choosing the most appropriate (and specific) method names. As was
already pointed out, it doesn't make sense for a file-based class to
use the "connection" metaphor; "opening a file" is more natural.
So let's leave this up to the developer, and if their chosen scheme
doesn't make sense, someone will raise a flag when the API and code is
reviewed.
--
Jon Parise (jon@php.net) :: The PHP Project (http://www.php.net/)