Re: [PHP-PEAR] [drift] About function renaming

[email protected] (Chuck Hagenbuch)
Newsgroups php.pear
Message-ID <[email protected]>
Quoting "Hellekin O. Wolf" <[email protected]>:

> - 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, <[email protected]>
"My intuitive grasp of math often leads me astray." -Me
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.