RE: [PEAR-QA] CS discussion
| From: | Lukas Smith | Date: | Tue, 15 Jul 2003 18:58:26 +0000 |
| Subject: | RE: [PEAR-QA] CS discussion | ||
| References: | 1 | Groups: | php.pear.qa |
| Request: | Send a blank email to pear-qa+get-59@lists.php.net to get a copy of this message | ||
> From: Martin Jansen [mailto:mj@php.net]
> Sent: Tuesday, July 15, 2003 8:43 PM
> On Tue Jul 15, 2003 at 01:4538PM +0200, Lukas Smith wrote:
> > <?php
> > if ((condition1)
> > || (condition2)
> > ) {
> > action1;
> > } elseif ((condition3)
> > && (condition4)
> > ) {
> > action2;
> > } else {
> > defaultaction;
> > }
> > ?>
>
> Generally this looks nice for me, but I'm wondering if we really need
to
> regulate this in the Coding Standards?
Not sure if this is going too far but atleast it confuses me enough to
have it different in MDB and LiveUser to be an annoyance.
> > 2) method naming
> > here are a few suggestions:
> >
> > factory() (instead of connect() or create())
>
> I guess you are *only* talking about situations, where connect() or
> create() implement the factory pattern, right?
Of course :-)
> > singleton() (instead of getInstanceOf())
> > connect() (instead of open())
> > disconnect() (instead of close() or quite())
>
> When working with files, (dis)connect() can be somewhat misleading,
don't
> you
> think?
Hmm not sure what the best solution is there. I tend to think that even
there it would be beneficial to use (dis)connect(). The first thing you
might be looking for would be open()/close() however if they are absent
I think it would be quite obvious that (dis)connect() is the method you
want. And making this the same across all classes is cleaner, especially
with so many PEAR classes allowing file and database access through
containers.
Regards,
Lukas