Re: CS questions
| From: | Klaus Guenther | Date: | Sun, 23 Nov 2003 14:33:04 +0000 |
| Subject: | Re: CS questions | ||
| References: | 1 | Groups: | php.pear.qa |
| Request: | Send a blank email to pear-qa+get-227@lists.php.net to get a copy of this message | ||
From: "Lukas Smith" <smith@backendmedia.com>
> However we also have the golden rule that Class names should cleanly map
to
> Installdirs by mapping "_" to "/".
>
> Now this would imply that 2) is actually a CS violation!
Yes, I think so. However, we shouldn't clutter the root directory too much.
And anyway, why is the LiveUser cvs directory called Perm_LiveUser? Doesn't
that indicate that LiveUser.php should be installed as Perm/LiveUser.php?
Iirc, LU used to be in the perm directory, but now has a top-level
directory. Don't know if that's really a good thing. Because if we accept
another authentification/permission package, it would also be top level?
Personally I'm not sure that's a good thing. Only categories should have
top-level directories (of course, DB is both a package and a category at the
same time, and should stay in the same place for legacy reasons).
> 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.
> 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
> IV) ok now really the last one:
> Whatever happened to the CS that true, false and null should be
lowercased?
> I seem to remember that this was a CS requirement (which I really hate
too)
> that was featured in the manual. Now that I changed everything for MDB 2.x
I
> cant seem to find it in the manual anymore.
Well yes, I remember it being in the manual, too. Do you know what happened
to it, Martin?
Klaus