Re: [drift] About function renaming
| From: | Chuck Hagenbuch | Date: | Wed, 14 Feb 2001 21:51:33 +0000 |
| Subject: | Re: [drift] About function renaming | ||
| Groups: | php.pear | ||
| Request: | Send a blank email to php-pear+get-1349@lists.php.net to get a copy of this message | ||
Quoting "Hellekin O. Wolf" <hellekin@php.net>:
> - Root-level-class (aka Packages) names are Studly_Caps (Most are acronyms
> anyway)
> - Other class names are studlyCaps
The current PEAR standard (which isn't entirely enforced) is:
All words in a class name begin in uppercase.
Classes are types. Types should stand out from variable names, functions,
objects, etc.
Underscores ('_') indicate levels of hierarchy - in the namespace, and also in
the filesystem structure.
We need some method of denoting namespaces. '.' isn't available, so we can't
exactly mimic java, but being consistent here lets you do things like easily
turning filenames into class names and vice versa.
Individual hierarchy levels are studlyCapped.
There needs to be some distinction between words, and _ is reserved for
denoting the namespace/hierarchy. That leaves studlyCaps.
Acronyms are kept capitalized.
They're acronyms; the capitalization means something.
Examples:
All of the DB classes should be uppercased: DB_Mysql, DB_Oracle, DB_OCI8, etc.
A class for searching text quickly might be called Text_FastSearch, and would
live in Text/FastSearch.php.
If you extended this class, you might call it Text_FastSearch_Extended, and the
file would be Text/FastSearch/Extended.php.
A top-level HTML class would be called just 'HTML', and live in HTML.php.
How's that?
-chuck
--
Charles Hagenbuch, <chuck@horde.org>
"My intuitive grasp of math often leads me astray." -Me