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

[email protected] ("Stig S. Bakken")
Newsgroups php.pear
Organization Fast Search & Transfer
Message-ID <[email protected]>
Chuck Hagenbuch wrote:
> 
> 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.

There's one problem with this: the DB factory method doesn't know how to
(and IMHO shouldn't know how to) capitalize the driver name, so I want
to make an exception for DB, keeping it all lowercase like today. 
Nobody should be using the DB backend classes directly anyway unless
they know what they are doing.

> 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?

I think this is good.

 - Stig
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.