CS discussion
| From: | Lukas Smith | Date: | Tue, 15 Jul 2003 11:45:38 +0000 |
| Subject: | CS discussion | ||
| Groups: | php.pear.qa | ||
| Request: | Send a blank email to pear-qa+get-50@lists.php.net to get a copy of this message | ||
Hi,
as a one time "spaces instead of tabs" hater .. here I am suggesting yet
more CS crap :-)
1) control structures
this is what we currently have in the manual:
<?php
if ((condition1) || (condition2)) {
action1;
} elseif ((condition3) && (condition4)) {
action2;
} else {
defaultaction;
}
?>
I would like to extend this to also include a standard on how to break
up such structures across multiple lines
<?php
if ((condition1)
|| (condition2)
) {
action1;
} elseif ((condition3)
&& (condition4)
) {
action2;
} else {
defaultaction;
}
?>
notice that the opening curly brackets gets moved to its own line along
with the normal bracket
also notice that the logical concatenator (or whatever its called) is
also on the next line .. way more readable and also nice since during
development you can comment out blocks in the statement easier
2) method naming
here are a few suggestions:
factory() (instead of connect() or create())
singleton() (instead of getInstanceOf())
connect() (instead of open())
disconnect() (instead of close() or quite())
regards,
Lukas Smith
smith@backendmedia.com
_______________________________
BackendMedia
www.backendmedia.com
berlin@backendmedia.com
Linn Zwoch Smith GbR
Pariser Str. 44
D-10707 Berlin
Tel +49 30 83 22 50 00
Fax +49 30 83 22 50 07