Re: CS discussion
| From: | Davey | Date: | Wed, 16 Jul 2003 07:41:06 +0000 |
| Subject: | Re: CS discussion | ||
| References: | 1 | Groups: | php.pear.qa |
| Request: | Send a blank email to pear-qa+get-65@lists.php.net to get a copy of this message | ||
Personally, I prefer the following:
if ((condition1) || (condition2) &&
(condition3)){
action1;} elseif (
action2;} else {
defaultaction;} By ending the top line on the operator, it is clear that we are going onto another line and that a ) was not forgotten and by putting the opening brace on a new line it is clear it is the end of the if() { and also makes the whitespace seem more natural (otherwise it looks like you should have 8 spaces to indent it past the second line of conditions) - Davey Lukas Smith wrote:
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