Naming convensions
| From: | Stoyan Stefanov | Date: | Wed, 03 Aug 2005 17:40:03 +0000 |
| Subject: | Naming convensions | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-39171@lists.php.net to get a copy of this message | ||
Hi guys,
I was just looking at the changelog for Net_Curl (Great job, BTW!
setOptions() and getInfo() were really needed). I saw this entry:
- Fixed coding standards, which included variable name changes (ie.
http_headers to httpHeaders)
I think both $some_var and $someVar are acceptable, there's no strict
rule for the variables stated here
http://pear.php.net/manual/en/standards.naming.php
Is it OK for a PEAR package to use $some_var?
Another thing - the naming conventions doc state that global vars
should start with an underscore followed by the package name, like
$_PEAR_whatever or $_PEAR_destructor_object_list. But the example
(http://pear.php.net/manual/en/standards.sample.php) doesn't have an
underscore ($GLOBALS['NET_SAMPLE_Count'] = 0) and in addition it
capitalizes the package name and the first letter of the
after-package-name part. To me, this should be:
$GLOBALS['Net_Sample_count'] = 0;
because it is consistent with the package naming convention, the
$some_vars naming and the $_PEAR_destructor_object_list example,
mentioned in the naming convention manual entry
(http://pear.php.net/manual/en/standards.naming.php, very bottom)
I'm sure that wars have been fought over the coding standards, as
everybody has their own "coding handwriting" preferences, but I think
the variable naming needs to be addressed, just to avoid confusion. It
could be as simple as just a mention in the naming conventions that
both $some_vars and $someVars are OK and fixing that global var in the
sample.
Stoyan