Re: CS questions
| From: | Klaus Guenther | Date: | Sun, 23 Nov 2003 17:10:33 +0000 |
| Subject: | Re: CS questions | ||
| References: | 1 | Groups: | php.pear.qa |
| Request: | Send a blank email to pear-qa+get-229@lists.php.net to get a copy of this message | ||
From: "Lukas Smith" <smith@backendmedia.com>
Sent: Sunday, November 23, 2003 3:37 PM
> Which would also mean that LiveUser would have to fix it's class names and
> prepend them with a 'Perm_'.
Fortunately, LiveUser hasn't reached 1.0 yet :-) And the package name should
be changed to Perm_LiveUser. Of course, now is the time to hash out the
exact category.
> > > II) I have another questions:
> > > Is a classname like "DB_mysql" allowed? Or should this really be
> > DB_Mysql?
> > > In that case the file should also be called Mysql.php and not
mysql.php?
> > > Should we even care?
> >
> > Yes, it should indeed be capitalized. See
> > http://pear.php.net/manual/en/standards.naming.php Keeping
> > this standard
> > prevents typos from clogging up our list ("How come
> > include('DB/Mysql.php')
> > doesn't work?") Of course, windows users won't have this problem, but
it's
> > a
> > good thing to keep things uniform.
>
> Yes .. especially with autoload coming up with php5.
Precisely
> > > III) Finally another question:
> > > How about variable names?
> > > We have a few people that use studlyCaps even for variable names.
> > > Other people simply use underscores to separate words. Should be find
a
> > > standard here? Should be not even care?
> >
> > In my understanding, variable names fall under the same CS as function
> > names -- studlyCaps. That's what I've used in all my packages, too. It
> > makes
> > it much easier to read the classes if CS is uniform. However, I see in
the
> > manual that there is no mention of variable naming standards. And the
> > example for global variables doesn't use it either, though imho, global
> > variables should follow the class naming pattern.
> > http://pear.php.net/manual/en/standards.naming.php
>
> I think half of PEAR does it one way and half the other :-/
Well, I'm for forcing studlyCaps for all properties (whether public or not).
However, within the functions, I think we can leave it up to the individual
developer (of course, arguments should be studlyCaps as well).
Regards,
Klaus