Re: PHP Standard style of writing your code
| From: | Barry | Date: | Tue, 02 May 2006 14:49:05 +0000 |
| Subject: | Re: PHP Standard style of writing your code | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-235270@lists.php.net to get a copy of this message | ||
Ford, Mike schrieb:
On 02 May 2006 14:19, Barry wrote:Sez you. To me, it totally does, and by quite a large factor. For you. Probably. But we are talking about "standards"Oh my god -- curly brackets and excessive indentation --and curly brackets. Just a mo, where did I put my curly-brackets-and-whitespace-glasses? Aaaahhh, that's better!!As you might have guessed, I *HATE* curly brackets with avengeance, which is why I eschew both those styles and use PHP's alternative syntax:if (...):Replacing { with : and } with endif doesn't make it more readable at all.if (...): // mmh else: // oh endif; while (...): if (...): // oh else: if (...): // where am i? else: // huh!? endif; // hmm endif; if (...): if (...): // blah endif; // blah endif;// blah endif;
Fair enough. Whereas to me, in any of the curly-brace styles, all I see on a first look is all those curly braces leaping up and trying to scratch my eyes with their sharp little pointy bits. Each to his own preference. Well i'd like to comment that sentence but something in me is telling me i should not.Just beeeautiful!Still extreme compacted code. I just see codesalad on first look, nothing else.
We should all just say thank goodness PHP lets us each do it to our own preference -- I would daily curse the curly brackets if I had to use your style, and you would long to expand my compact code if you had to use mine. And at least we can all agree (we can, right?) that almost *any* kind of decent layout is better than: if (...): if (...): // mmh else: /* oh */ endif; while (...): if (...): /* oh */ else: if (...): // where am i? else: /* huh!? */ endif; /* hmm */ endif; if (...): if (...): /* blah */ endif; /* blah */ endwhile; /* blah */ endif; Now that's extreme compaction -- and, yes, I have seen code written like that!! ;( OMG. worst case scenario....-- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)