Re: PHP Standard style of writing your code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ford, Mike schrieb:
On 02 May 2006 14:19, Barry wrote:

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 a
vengeance, which is why I eschew both those styles and use
PHP's alternative syntax:
  if (...):
     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;
Replacing { with : and } with endif doesn't make it more
readable at all.

Sez you. To me, it totally does, and by quite a large factor.
For you. Probably. But we are talking about "standards"

Just beeeautiful!
Still extreme compacted code.
I just see codesalad on first look, nothing else.

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.

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)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux