Re: [PHP] PHP Standard style of writing your code

2006-05-03 Thread Richard Lynch
On Tue, May 2, 2006 4:07 am, Barry wrote:
[snip]

Barry;

I'm sorry, but you screwed up the indentation in the sample with
in-line brackets.

So, duh, it's unreadable.

 I bet you would have problems coding so much nested IFs or such, i did
 had them writing that first style above.

I haven't had a problem with it in 20 years of coding.

 Bt.

 Without indentation, it's just garbage.

 I've seen ppl coding like that.
 And using that inline bracket method just makes it so hard to read.

Once again, I'm sorry you find it hard to read.

But then, since you indented improperly when you used inline braces,
that's no surprise. :-)

 If you indent, you see it as you scroll through without actually
 reading it no matter where you put the braces.

 I give an example.
 Probably you see for yourself what of those would be rad better and
 faster (^_^)

[snip]

I can read them equally fast, because they are properly indented.

Now what?

 I frequently code on smaller monitors -- laptop, ancient desktop,
 stripped-down flat-panel monitor that fits inside a rack-mount 2-RU
 shelf in my sound booth...
 Yes, and some people actually code on PALM handhelds and i have seeing
 ppl coding on mobile phones.
 There won't fit your 80 chars per line style. Are you going to strip
 it
 down to 13 per line now because of that?

No, I suffer like anybody else does when you're on that small a screen.

Well, I suffer a little bit less than you do, as I've wasted fewer
lines. :-)

 But i think i would just give up coding.
 That's IMHO no way you can code good in such places.

Errr.  Okay Barry.  All the code written on small monitors is
inherently bad in your world-view. :-)

I'm outta this thread.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] PHP Standard style of writing your code

2006-05-03 Thread Richard Lynch
On Tue, May 2, 2006 8:49 am, tedd wrote:
   And for your problem with viewing. probably try to get a 19
 monitor.
  They are not that expencive anymore.(The CRT ones)
  Even on 1024x768 you see LOTSA code.

I frequently code on smaller monitors -- laptop, ancient desktop,
stripped-down flat-panel monitor that fits inside a rack-mount 2-RU
shelf in my sound booth...

I can't really lug a 19 monitor all over, and there's no room in my
sound booth for it, what with the amps, sound boards, computer, CD
duplicator, etc.

 If cost is not an object, consider a MacBook Pro -- it runs windozes
 and has a 17 inch monitor, which provides 1680 x 1050 resolution.
 Nice monitor for a laptop.

We're talking about several different machines here...

The laptop, the computer in the sound booth, and my desktop.

None of which have particularly large monitors...

The desktop could have a large monitor if A) I could afford it or B)
I could manage to jury-rig the ancient RssterOps 21 to the AT-case
KVM switch...  Well, not today.

Focusing mostly on the smallest monitor in question, an LCD 13 with
the leg-stand ripped off:

A) Cost is an object.
B) Weight is an object, for laptop.
C) Space is an object.
D) I'm reasonably certain it won't fit in the sound booth 1 RU space.
E) I don't WANT Windows in my sound booth. Nor OS X, for that matter.

I'm quite happy with the gear I have, actually.

Come to think of it, even with the 21 monitor on my old desktop, I
still wanted maximum code on-screen at any given time. [shrug]

I should have left the actual monitor size out of it -- Or just
ignored it when it got dragged in.

You need to understand that Im the kind of guy who keeps using the
same desktop AMD K6 450 mHz for, oh, 10 years now? because it works
fine.

I spend 99% of my ssh-ed out to some BSD server somewhere anyway, so
why would I blow a fortune on a new desktop?

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] PHP Standard style of writing your code

2006-05-03 Thread Barry

Richard Lynch schrieb:

On Tue, May 2, 2006 4:07 am, Barry wrote:
[snip]

Barry;

I'm sorry, but you screwed up the indentation in the sample with
in-line brackets.

So, duh, it's unreadable.


It's not quite easy to intend in mail clients because that might be they 
are not suited for coding at all.




I can read them equally fast, because they are properly indented.

Now what?


And i can't. Now what?
See that's the problem.
We are talking about standarts and not a Richard Lynch-Standard.
Sorry, it doesn't mean anything to this thread if you can read it good / 
fast or not.

Neither if i can.


No, I suffer like anybody else does when you're on that small a screen.
I coded BASIC in school on 12 monochrome screens and never had any 
problems reading code.

That might be because you just had one line above with File, Edit and such.
Nowadays the whole screen is filled with blinky toolboxes and code 
insight class showing thingies.
No wonder ppl start to compress the code as much as possible to have 
their beautiful usless stuff on screen.



Well, I suffer a little bit less than you do, as I've wasted fewer
lines. :-)


Really, you cant waste something where you have infinite of it.


Errr.  Okay Barry.  All the code written on small monitors is
inherently bad in your world-view. :-)


I told you: That's IMHO no way you can code good in such places.
Never said it's bad code just said it's bad to code!


I'm outta this thread.
Probably a good choice since you like to not read statements and 
comments properly.


Barry

--
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



Re: [PHP] PHP Standard style of writing your code

2006-05-03 Thread tedd

Problem stated:

At 4:54 AM -0500 5/3/06, Richard Lynch wrote:


 I can't really lug a 19 monitor all over, and there's no room in my

sound booth for it, what with the amps, sound boards, computer, CD
duplicator, etc.


Suggestion offered for consideration:


  If cost is not an object, consider a MacBook Pro -- it runs windozes

 and has a 17 inch monitor, which provides 1680 x 1050 resolution.

  Nice monitor for a laptop.


Reply to suggestion:


-snip- so why would I blow a fortune on a new desktop?


Reply:

Okay, don't -- it was just something to consider.

tedd
--

http://sperling.com

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



Re: [PHP] PHP Standard style of writing your code

2006-05-02 Thread Barry

Rafael schrieb:

IMHO, vertical aligned brackets can be messy when nesting
relatively-small blocks (and seems to me like a lot of wasted space)

Huh?!
Show an example. I don't think you will be able to show one.
But this wasted space gives you a lot more insight into the code when 
looking for loops,whiles,functions and such.



A couple of facts of my codding style:
- I tend to always use brakets, so I ignore the fact that single
  lines/actions can be written without brackets,

This is your coding style.
But if you work in a team, and somone does use that because it actually 
is a neater way of programming.

What do you intend to do?

- I try not to let lines grow larger than about 100 cols (cannot
  be really done with strings and other thingies, and maybe that
  should remain in the old 80 cols, but it's too litle space), and

Never possible if you write web-applications.
CLI might be possible for that but for web it's a no-go.


- I use a 4 space indentation, and that alone suffices for making
  a block stand clear enough

It's not just about one block.
I've seen stuff like:
if (blah blah) {
do my code!
} else {
oh my god!
}

Well, without indentation it just looks like a bunch of chars.

if (blah blah)
{
do my code!
}
else
{
oh my god!
}

Even without intendations, you can clearly see that it's an if and an 
else here.

The best part here is that you see it when you scroll through your code.
without actually reading it.


So, in my case, the code would be something like
  function foo( $x ) {
  // body...
  }
  ···
  $a = foo($b);

Even this is far too blocky to read.
If you have 4000 rows of code and looking for some if or switch (you are 
not sure) it would save you a lot of time searching for it though.


And for your problem with viewing. probably try to get a 19 monitor.
They are not that expencive anymore.(The CRT ones)
Even on 1024x768 you see LOTSA code.

--
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



Re: [PHP] PHP Standard style of writing your code

2006-05-02 Thread Richard Lynch
On Tue, May 2, 2006 3:02 am, Barry wrote:
 Rafael schrieb:
 IMHO, vertical aligned brackets can be messy when nesting
 relatively-small blocks (and seems to me like a lot of wasted space)
 Huh?!
 Show an example. I don't think you will be able to show one.
 But this wasted space gives you a lot more insight into the code when
 looking for loops,whiles,functions and such.

if (...)
{
  if (...)
  {
if (...)
{
  //blah
}
//blah
  }
  //blah
}

 A couple of facts of my codding style:
 - I tend to always use brakets, so I ignore the fact that single
   lines/actions can be written without brackets,
 This is your coding style.
 But if you work in a team, and somone does use that because it
 actually
 is a neater way of programming.
 What do you intend to do?

Grin and bear it.

 - I use a 4 space indentation, and that alone suffices for making
   a block stand clear enough
 It's not just about one block.
 I've seen stuff like:
 if (blah blah) {
 do my code!
 } else {
 oh my god!
 }

 Well, without indentation it just looks like a bunch of chars.

YES!!!

Without indentation you are SCREWED.

Nobody is arguing against that!

 if (blah blah)
 {
 do my code!
 }
 else
 {
 oh my god!
 }

 Even without intendations, you can clearly see that it's an if and an
 else here.

Bt.

Without indentation, it's just garbage.

 The best part here is that you see it when you scroll through your
 code.
 without actually reading it.

If you indent, you see it as you scroll through without actually
reading it no matter where you put the braces.

 So, in my case, the code would be something like
   function foo( $x ) {
   // body...
   }
   ···
   $a = foo($b);
 Even this is far too blocky to read.
 If you have 4000 rows of code and looking for some if or switch (you
 are
 not sure) it would save you a lot of time searching for it though.

 And for your problem with viewing. probably try to get a 19 monitor.
 They are not that expencive anymore.(The CRT ones)
 Even on 1024x768 you see LOTSA code.

I frequently code on smaller monitors -- laptop, ancient desktop,
stripped-down flat-panel monitor that fits inside a rack-mount 2-RU
shelf in my sound booth...

I can't really lug a 19 monitor all over, and there's no room in my
sound booth for it, what with the amps, sound boards, computer, CD
duplicator, etc.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] PHP Standard style of writing your code

2006-05-02 Thread Barry

Richard Lynch schrieb:

On Tue, May 2, 2006 3:02 am, Barry wrote:

Rafael schrieb:

IMHO, vertical aligned brackets can be messy when nesting
relatively-small blocks (and seems to me like a lot of wasted space)

Huh?!
Show an example. I don't think you will be able to show one.
But this wasted space gives you a lot more insight into the code when
looking for loops,whiles,functions and such.


if (...)
{
  if (...)
  {
if (...)
{
  //blah
}
//blah
  }
  //blah
}


Sorry, where is this here better?
if (...) {
  if (...) {
if (...) {
  // blah
}
  //blah
  }
//blah
}

And then it goes like:
if (...) {
  if (...) {
// mmh
  } else {
// oh
  }
  while (...) {
if(...) {
  // oh
} else {
  if (...) {
// where am i?
} else {
  // huh!?
}
  // hmm
}
  if (...) {
if (...) {
  // blah
}
  // blah
  }
// blah
}
The same as above in the other style:
if (...)
{
  if (...)
  {
//mmh
  }
  else
  {
//oh
  }
  while (...)
  {
if (...)
{
  //oh
}
else
{
  if (...)
  {
//where am i?
  }
  else
  {
//huh!?
  }
  // hmm
}
  if (...)
  {
if (...)
{
  // blah
}
// blah
  }
  // blah
}

I know you could use elseif, but it's okay like this for presentation.

I bet you would have problems coding so much nested IFs or such, i did 
had them writing that first style above.



Bt.

Without indentation, it's just garbage.


I've seen ppl coding like that.
And using that inline bracket method just makes it so hard to read.



If you indent, you see it as you scroll through without actually
reading it no matter where you put the braces.


I give an example.
Probably you see for yourself what of those would be rad better and 
faster (^_^)


Your style:
function findetag() {
$wochentag = func_get_arg (0);
if (func_num_args() = 2) {
$letztezeit = func_get_arg (1);
} else {
$letztezeit = time();
}
$count=0;
$taggefunden = false;
while (!$taggefunden) {
$count++;
$tagarray = getdate($letztezeit);
if (strtolower($wochentag) == strtolower($tagarray[weekday])) 
{
$taggefunden = true;
} else {
// tag drauf
$letztezeit = $letztezeit+86400;
}
//endlosschleife abbrechen
if ($count  20) {
$taggefunden = true;
$letztezeit = false;
}
}
return $letztezeit;
}

My style:
function findetag()
{
$wochentag = func_get_arg (0);
if (func_num_args() = 2)
{
$letztezeit = func_get_arg (1);
}
else
{
$letztezeit = time();
}
$count=0;
$taggefunden = false;
while (!$taggefunden)
{
$count++;
$tagarray = getdate($letztezeit);
if (strtolower($wochentag) == 
strtolower($tagarray[weekday]))
{
$taggefunden = true;
}
else
{
// tag drauf
$letztezeit = $letztezeit+86400;
}
//endlosschleife abbrechen
if ($count  20)
{
$taggefunden = true;
$letztezeit = false;
}
}
return $letztezeit;
}

On first view i can clearly see what is happening without going 
through the code.




I frequently code on smaller monitors -- laptop, ancient desktop,
stripped-down flat-panel monitor that fits inside a rack-mount 2-RU
shelf in my sound booth...
Yes, and some people actually code on PALM handhelds and i have seeing 
ppl coding on mobile phones.
There won't fit your 80 chars per line style. Are you going to strip it 
down to 13 per line now because of that?


Yes you can actually code it that it fits in any small space so that you 
might even see it on a digital watch.


But that fact shouldn't be affecting coding style at all.


I can't really lug a 19 monitor all over, and there's no room in my
sound booth for it, what with the amps, sound boards, computer, 

RE: [PHP] PHP Standard style of writing your code

2006-05-02 Thread Ford, Mike
On 02 May 2006 10:07, Barry wrote:

 Richard Lynch schrieb:
  On Tue, May 2, 2006 3:02 am, Barry wrote:
   Rafael schrieb:
IMHO, vertical aligned brackets can be messy when nesting
relatively-small blocks (and seems to me like a lot of
 wasted space)
   Huh?!
   Show an example. I don't think you will be able to show one.
   But this wasted space gives you a lot more insight into the code
   when looking for loops,whiles,functions and such.
  
  if (...)
  {
if (...)
{
  if (...)
  {
//blah
  }
  //blah
}
//blah
  }
  
 Sorry, where is this here better?
 if (...) {
if (...) {
  if (...) {
// blah
  }
//blah
}
 //blah
 }

Very nice. Lovely, readable, compact code. (Apart form all those horrible curly 
brackets.)

 And then it goes like:
 if (...) {
if (...) {
  // mmh
} else {
  // oh
}
while (...) {
  if(...) {
// oh
  } else {
if (...) {
  // where am i?
  } else {
// huh!?
  }
// hmm
  }
if (...) {
  if (...) {
// blah
  }
// blah
}
 // blah
 }

Yes - still lovely, readable, compact code.  And dead simple to spot you've 
failed to indent the else section after // where am i?. (Apart from all 
those horrible curly brackets.)

 The same as above in the other style:
 if (...)
 {
if (...)
{
  //mmh
}
else
{
  //oh
}
while (...)
{
  if (...)
  {
//oh
  }
  else
  {
if (...)
{
  //where am i?
}
else
{
  //huh!?
}
// hmm
  }
if (...)
{
  if (...)
  {
// blah
  }
  // blah
}
// blah
 }

Uurgh -- curly  brackets -- I see curly brackets -- and, aargh, horrible curly 
brackets -- eeew, and I think some code, maybe -- but definitely curly brackets.

 Your style:
 function findetag() {
   $wochentag = func_get_arg (0);
   if (func_num_args() = 2) {
   $letztezeit = func_get_arg (1);
   } else {
   $letztezeit = time();
   }
   $count=0;
   $taggefunden = false;
   while (!$taggefunden) {
   $count++;
   $tagarray = getdate($letztezeit);
   if (strtolower($wochentag) ==
 strtolower($tagarray[weekday])) {
   $taggefunden = true;
   } else {
   // tag drauf
   $letztezeit = $letztezeit+86400;
   }
   //endlosschleife abbrechen
   if ($count  20) {
   $taggefunden = true;
   $letztezeit = false;
   }
   }
   return $letztezeit;
 }

Yep, nice -- still too many curly brackets, but readable.

 My style:
 function findetag()
   {
   $wochentag = func_get_arg (0);
   if (func_num_args() = 2)
   {
   $letztezeit = func_get_arg (1);
   }
   else
   {
   $letztezeit = time();
   }
   $count=0;
   $taggefunden = false;
   while (!$taggefunden)
   {
   $count++;
   $tagarray = getdate($letztezeit);
   if (strtolower($wochentag) ==
 strtolower($tagarray[weekday]))
   {
   $taggefunden = true;
   }
   else
   {
   // tag drauf
   $letztezeit =
 $letztezeit+86400;
   }
   //endlosschleife abbrechen
   if ($count  20)
   {
   $taggefunden = true;
   $letztezeit = false;
   }
   }
   return $letztezeit;
   }

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
 

Re: [PHP] PHP Standard style of writing your code

2006-05-02 Thread Barry



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.



Just beeeautiful!


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


 And, oh look, all the end tags tell me which kind of start tag they should 
match.  And the compiler.  Which leads to much more focussed error messages 
when you cock your structure up.  I can't remeber the last time PHP told me I 
had a syntax arror at the end of the file -- if I've got unbalanced start/end 
tags, the error message usually points to a line in the middle of the file, 
slap bang in the target area.

Yeah true. : and endif is nicer.
But it's a bit more about the formatting.

Barry
--
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



Re: [PHP] PHP Standard style of writing your code

2006-05-02 Thread tedd

  And for your problem with viewing. probably try to get a 19 monitor.

 They are not that expencive anymore.(The CRT ones)
 Even on 1024x768 you see LOTSA code.


I frequently code on smaller monitors -- laptop, ancient desktop,
stripped-down flat-panel monitor that fits inside a rack-mount 2-RU
shelf in my sound booth...

I can't really lug a 19 monitor all over, and there's no room in my
sound booth for it, what with the amps, sound boards, computer, CD
duplicator, etc.


If cost is not an object, consider a MacBook Pro -- it runs windozes 
and has a 17 inch monitor, which provides 1680 x 1050 resolution. 
Nice monitor for a laptop.


tedd
--

http://sperling.com

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



RE: [PHP] PHP Standard style of writing your code

2006-05-02 Thread Ford, Mike
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.

  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.

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!! 
;(

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 



To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



RE: [PHP] PHP Standard style of writing your code

2006-05-02 Thread tedd
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:


And, I *LOVE* curly brackets -- before them we had repeat the opening 
statement statement in some fashion, such as FOR/NEXT, WHILE/WEND, 
IF/END IF. Curly brackets allow us to shorten the code and it looks a 
lot better to me.


tedd

PS: Barry, you and I use the exact same style -- you must be very 
intelligent. ;-)

--

http://sperling.com

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



Re: [PHP] PHP Standard style of writing your code

2006-05-02 Thread Barry

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



Re: [PHP] PHP Standard style of writing your code

2006-05-02 Thread Barry

tedd schrieb:
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:


And, I *LOVE* curly brackets -- before them we had repeat the opening 
statement statement in some fashion, such as FOR/NEXT, WHILE/WEND, 
IF/END IF. Curly brackets allow us to shorten the code and it looks a 
lot better to me.


At any rate. Brackets do really fast show where the beginning and the 
end is.

IF the brackets are set up in a logial order.

Besides any standards:
if (...) {
}
elseif (...)
{
} else {
}

This is actually we will see probably someday if noone gets a good 
standard up :P


Ahaha:
For I = 0 STEP 5;
NEXT I;

i love that XD

C64 rulez :P



PS: Barry, you and I use the exact same style -- you must be very 
intelligent. ;-)

Or very stupid, depends on who looks at us ^_^

--
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



Re: [PHP] PHP Standard style of writing your code

2006-05-02 Thread tedd

Barry:

PS: Barry, you and I use the exact same style -- you must be very 
intelligent. ;-)

Or very stupid, depends on who looks at us ^_^



To paraphrase Will Rogers, We're all stupid, only in different subjects.

tedd

--

http://sperling.com

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



Re: [PHP] PHP Standard style of writing your code

2006-05-02 Thread Robert Cummings
On Tue, 2006-05-02 at 04:02, Barry wrote:
  - I try not to let lines grow larger than about 100 cols (cannot
be really done with strings and other thingies, and maybe that
should remain in the old 80 cols, but it's too litle space), and
 Never possible if you write web-applications.
 CLI might be possible for that but for web it's a no-go.

I think you're kidding. I write web applications all the time and
constrain my line width's to 80 columns. If you are speaking to embedded
HTML code then I can see your problem.. but I use a good templating
system which keeps most html out of my code... and I never use what I
consider to be the ugliest style of all... switching back and forth
between PHP and HTML mode.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



RE: [PHP] PHP Standard style of writing your code

2006-05-02 Thread Robert Cummings
On Tue, 2006-05-02 at 09:03, Ford, Mike wrote:

 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;
 
 Just beeeautiful!  And, oh look, all the end tags tell me which kind of start 
 tag they should match.  And the compiler.  Which leads to much more focussed 
 error messages when you cock your structure up.  I can't remeber the last 
 time PHP told me I had a syntax arror at the end of the file -- if I've got 
 unbalanced start/end tags, the error message usually points to a line in the 
 middle of the file, slap bang in the target area.

Dearh Mike,

You appear to have found a PHP mailing list when in fact your code
appears to be VB. Please search the net for a more appropriate mailing
list.

*hahahah -- runns away cackling*

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] PHP Standard style of writing your code

2006-05-02 Thread Robert Cummings
On Tue, 2006-05-02 at 11:06, tedd wrote:
 Barry:
 
 PS: Barry, you and I use the exact same style -- you must be very 
 intelligent. ;-)
 Or very stupid, depends on who looks at us ^_^
 
 
 To paraphrase Will Rogers, We're all stupid, only in different subjects.

Speak for yourself dum dum ;)  (double entendre intended).

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] PHP Standard style of writing your code

2006-05-02 Thread John Meyer
Should we really have this arguement about a standard way of writing 
the code?  This is PHP, an open-source project.  Isn't that like asking 
existentialists to adopt a uniform code of conduct?


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



Re: [PHP] PHP Standard style of writing your code

2006-05-02 Thread Robert Cummings
On Tue, 2006-05-02 at 13:18, John Meyer wrote:
 Should we really have this arguement about a standard way of writing 
 the code?  This is PHP, an open-source project.  Isn't that like asking 
 existentialists to adopt a uniform code of conduct?

Yes but what would that code of conduct look like? Would it have
vertically aligned braces or not? ;)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



RE: [PHP] PHP Standard style of writing your code

2006-05-01 Thread Chris W. Parker
Richard Lynch mailto:[EMAIL PROTECTED]
on Saturday, April 29, 2006 12:12 AM said:

 Okay, but let's do keep this fairly serious, and let's NOT let it
 devolve into the usual religious flame-war this topic gets to...

Yeah I should have asked off list as I'm not interested in debating,
just simply curious of the other side's point of view.


Thanks!
Chris.

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



Re: [PHP] PHP Standard style of writing your code

2006-04-30 Thread Richard Lynch
On Sat, April 29, 2006 6:10 pm, Robert Cummings wrote:
 On Sat, 2006-04-29 at 10:56, Satyam wrote:

 A brace on its own line doesn't make sense to me.

 This begs the question... Where do you place the closing brace?

I think no matter which style one uses, the following statement is
correct:

The closing brace goes directly under the first character of the line
containing the opening brace.


THE REST OF THIS IS *WAY* OFF-TOPIC

Though, in Lisp, I would actually collapse closing parens on a
single line, and considered the closing parens isomorphic even
though the actual one closing any given paren would not be directly
under the opening line:

(let* ((x (+ xoffset 3))
   (y (+ yoffset 4))
  )
  (do* ((x1 x (+ x 1))
(y1 y (+ y 1))
(while ...
  (for ...
;;; body here
) ) ) ) ;;; just close all the damn things on one line...

4 lines in a row with one ')' each was just too much for me to deal
with...

I don't do that in PHP, but you don't generally have, like, 5 closing
braces in a row in PHP either.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] PHP Standard style of writing your code

2006-04-30 Thread Richard Lynch
On Sat, April 29, 2006 10:36 pm, D. Dante Lorenso wrote:
 However...you may need to make a policy in your company.  If you use
 source control for your software, it may see changes in formatting as
 a
 distinct major revision.  Therefore, if you save code in your style
 and another developer opens the file and resaves in his style, then
 you'll unnecessarily make version control a nightmare.  Despite
 personal
 preference, you MUST adhere to the style of the project.  If you are
 the
 sole developer, you define that style.  If you are a coding monkey,
 then
 you may have to suffer with the style that the architect before you
 declared.

I believe I was quite clear when I suggested that the IDE should *NOT*
alter the actual code -- it should simply *DISPLAY* the style I
prefer.

For that matter, any new code I type should, by definition, be saved
in the style the rest of the file is in, no matter which style is
being displayed at the moment.

I don't think there are any IDEs on the market that do this.

They all seem to think they know how to align things better than I do,
and generally just screw it up, and, yes, make version control a
nightmare if you actually try to use their silly auto-format.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] PHP Standard style of writing your code

2006-04-30 Thread tedd

Beautiful code often contains fewer bugs.

Dante



I agree -- but, if nothing else, they're at least prettier bugs. :-)

tedd
--

http://sperling.com

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



Re: [PHP] PHP Standard style of writing your code

2006-04-29 Thread Paul Novitski



IMHO, vertical aligned brackets can be messy when nesting
relatively-small blocks (and seems to me like a lot of wasted space)


I'm struggling to get my head around this concept of 'wasted space' 
with regard to software code.  What is it that's getting wasted, 
exactly?  If we printed our programs on paper it would be wasted 
trees (page-space) but I almost never do this and I don't know anyone 
who does except banks.  It could be seen as a waste of disk space, 
but only at the rate of a few bytes per code block, carriage return 
plus perhaps a couple of tabs.  What we must be talking about here is 
a waste of visual space.  How does visual space get wasted?  Isn't it 
possible to waste something only if it's in finite supply?  I guess 
it's being wasted if it's something valuable that's not being 
used.  However, the urge to add whitespace to spread things apart is 
done with the intent of making code easier to read, so that seems 
like a use, not a waste.


OK, OK, I'll stop.  Think I'll go out and get wasted~

P. 


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



Re: [PHP] PHP Standard style of writing your code

2006-04-29 Thread Robert Cummings
On Sat, 2006-04-29 at 01:38, Rafael wrote:
   IMHO, vertical aligned brackets can be messy when nesting

Explain messy!?

 relatively-small blocks (and seems to me like a lot of wasted space)

Did you just say wasted space? I mean it's not like 99.9% (pulled from
the dark recesses of my behind) of code gets printed. So that leaves
wasted space on what? My 500 gigs of HD space? You are kidding right?!

 A couple of facts of my codding style:

beat it over a head, gut it, cook over an open fire? ;)

 - I tend to always use brakets, so I ignore the fact that single

Are they tools to help you slow down?

lines/actions can be written without brackets,

I do so also, it's just good maintenance style since adding code to the
conditional doesn't require adding the braces in the future.

 - I try not to let lines grow larger than about 100 cols (cannot
be really done with strings and other thingies, and maybe that
should remain in the old 80 cols, but it's too litle space), and

I still keep my lines at 80... on rare cases 81 :)

 - I use a 4 space indentation, and that alone suffices for making
a block stand clear enough

Ditto... but those vertically aligned braces just make it eve clearer.

   So, in my case, the code would be something like
function foo( $x ) {
// body...
}
···
$a = foo($b);

Yeah, you're in the lynch camp... yeeuck ;)

Cheers,
Rob.

 Chris W. Parker wrote:
  So no matter what was actually typed, *I* would see:
  
 function foo ($x) {
   //body
 }
 
 but some heretic who doesn't know any better would see:
 function foo($x)
 {
   //body
 }
 [···]
  Setting aside the fact that you're completely wrong about your
  preference... ;)
  
  What, in your mind, is the advantage to putting the opening brace on
  the same line as the function call, logic statement, etc.? (Btw, this
  is a serious question!)
 [···]
 P.S.  What, in your mind, is the advantage of replying after quoting the 
 original message and not before? :)

Standard netiquette. Only top post when fighting the power :B

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'


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



Re: [PHP] PHP Standard style of writing your code

2006-04-29 Thread Robert Cummings
On Sat, 2006-04-29 at 02:08, Paul Novitski wrote:
  IMHO, vertical aligned brackets can be messy when nesting
 relatively-small blocks (and seems to me like a lot of wasted space)
 
 I'm struggling to get my head around this concept of 'wasted space' 
 with regard to software code.  What is it that's getting wasted, 
 exactly?  If we printed our programs on paper it would be wasted 
 trees (page-space) but I almost never do this and I don't know anyone 
 who does except banks.  It could be seen as a waste of disk space, 
 but only at the rate of a few bytes per code block, carriage return 
 plus perhaps a couple of tabs.  What we must be talking about here is 
 a waste of visual space.  How does visual space get wasted?  Isn't it 
 possible to waste something only if it's in finite supply?  I guess 
 it's being wasted if it's something valuable that's not being 
 used.  However, the urge to add whitespace to spread things apart is 
 done with the intent of making code easier to read, so that seems 
 like a use, not a waste.
 
 OK, OK, I'll stop.  Think I'll go out and get wasted~

Drink with friends... that way you have someone to brace you when you're
fall down drunk.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] PHP Standard style of writing your code

2006-04-29 Thread Rafael
	It's kind of ironic that you didn't split that big chunk of text into 
paragraphs, don't you think? ;)


	Anyway, yes, I was referring to visual space, we all know that is more 
clear the more you can see the code, that's why we don't let rows go 
insinely long (well, wide actually), and that also applies for the 
vertical viewport (rows also, not only columns)  That's why *I* find 
it a waste of (vertical) space.


	But, as we all know also, coding style is just that, a style, yet 
another matter of taste --of course, there are some basics that should 
always be present for the sake of clarity (such as indentation, 
comments, and an empty line here and there as logic-separator), or 
that's what I think, anyway --let's not discuss about this, wi'l ya?


Paul Novitski wrote:

IMHO, vertical aligned brackets can be messy when nesting
relatively-small blocks (and seems to me like a lot of wasted space)


I'm struggling to get my head around this concept of 'wasted space' with 
regard to software code.  What is it that's getting wasted, exactly?  If 
we printed our programs on paper it would be wasted trees (page-space) 
but I almost never do this and I don't know anyone who does except 
banks.  It could be seen as a waste of disk space, but only at the rate 
of a few bytes per code block, carriage return plus perhaps a couple of 
tabs.  What we must be talking about here is a waste of visual space.  
How does visual space get wasted?  Isn't it possible to waste something 
only if it's in finite supply?  I guess it's being wasted if it's 
something valuable that's not being used.  However, the urge to add 
whitespace to spread things apart is done with the intent of making code 
easier to read, so that seems like a use, not a waste.


OK, OK, I'll stop.  Think I'll go out and get wasted~

P.

--
Atentamente,
J. Rafael Salazar Magaña
Innox - Innovación Inteligente
Tel: +52 (33) 3615 5348 ext. 205 / 01 800 2-SOFTWARE
http://www.innox.com.mx

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



RE: [PHP] PHP Standard style of writing your code

2006-04-29 Thread Richard Lynch
On Fri, April 28, 2006 5:18 pm, Chris W. Parker wrote:
 Richard Lynch mailto:[EMAIL PROTECTED]
 on Monday, April 24, 2006 11:50 PM said:

 So no matter what was actually typed, *I* would see:

 function foo ($x) {
   //body
 }

 but some heretic who doesn't know any better would see:
 function foo($x)
 {
   //body
 }

 Now *THAT* would be a feature worth paying for in an IDE! :-)

 Setting aside the fact that you're completely wrong about your
 preference... ;)

 What, in your mind, is the advantage to putting the opening brace on
 the same line as the function call, logic statement, etc.? (Btw, this
 is a serious question!)

Okay, but let's do keep this fairly serious, and let's NOT let it
devolve into the usual religious flame-war this topic gets to...

Since it IS a religious question, I'm not super-interested in
discussing it with too many go-rounds...


The reasons I chose the brace-on-same-line style, way long time ago:


#1.
Screen real estate and lines of code are fairly precious to me.

Lines wasted for { on a line by itself is just, err, wasteful. :-)

Obviously, some consider that { line by itself useful, but I don't
consider the cost/benefit ratio sufficient to warrant the expense.


#2.
The indentation of the following lines is more than sufficient, with
practice, for the eye to follow the program flow.

An extra line, almost blank, does not make it any easier to see the
code flow.

To see this, you have to practice reading both styles in equal
measure, however, and most programmers don't really do that.


#3.
Obviously, whatever one gets used to typing for oneself is the EASIEST
to read.

But if you end up reading a lot of other people's code anyway, you
pretty much have to live with all the different styles.

I'd rather use the more compact style, since I have to be able to read
all of them anyway.


#4.
To me, the brace and what is going on in the program at that
juncture are inseparable from the logic that makes the brace
necessary.

I'm not sure how to express this well, but the best I can do is:

The logic and its brace are one and the same, not separate things, and
they should be on the same line because they are one and the same.

The code block body is indented, because it is encompassed by the
program logic, in the sense that the body is either executed or not
based on the logic.

The braces are not something to be executed or not executed, but are
simply delimiters for the code block body.  They are more a part of
the logical structure of the program logic, then they are a part of
the body, because they delimit the structure, rather than get executed
(or not).


#5.
If you print it out on that old-school 3-line alternating green-bar
fan-fold paper, and you hang it up across the room, it's much prettier
as ASCII art with the braces on the same line.

The preceding sentence is obviously a very subjective statement.

But I'm totally serious here -- I made this decision in college circa
1981, and I wrote the same long program both ways, and hung the two
versions up on the wall side-by-side, and I liked the one with { on
the same lines better.

I even solicited my non-programmer roommates' opinions, and they also
preferred the braces on the same line as ASCII art.

The extra practically blank lines version was not as pretty as ASCII
art from a distance.

Note that I (and obviously my roommtes) had no pre-conceived
preference before this ASCII art gallery test.

I daresay an experienced programmer is going to pick the style they
prefer as prettier.

Though it would be an interesting experiment for some psychology
student to A/B compare with programmers, non-programmers, experienced
programmers, etc...


Well, there it is, fwiw.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] PHP Standard style of writing your code

2006-04-29 Thread Richard Lynch
On Sat, April 29, 2006 1:08 am, Paul Novitski wrote:
 IMHO, vertical aligned brackets can be messy when nesting
relatively-small blocks (and seems to me like a lot of wasted space)

 I'm struggling to get my head around this concept of 'wasted space'
 with regard to software code.  What is it that's getting wasted,
 exactly?  If we printed our programs on paper it would be wasted
 trees (page-space) but I almost never do this and I don't know anyone
 who does except banks.  It could be seen as a waste of disk space,
 but only at the rate of a few bytes per code block, carriage return
 plus perhaps a couple of tabs.  What we must be talking about here is
 a waste of visual space.  How does visual space get wasted?  Isn't it
 possible to waste something only if it's in finite supply?  I guess
 it's being wasted if it's something valuable that's not being
 used.  However, the urge to add whitespace to spread things apart is
 done with the intent of making code easier to read, so that seems
 like a use, not a waste.

If you tend to have a fair amount of code with small blocks, and you
can only see X lines on the screen at once, then the wasted space is
in how much of the program logic you can view in one screenful.

I'll also respond to another poster:

I personally have no less/more ease in aligning } with a logic
statement or with another {, *IF* the code is indented properly.

In other words, the vertical alignment is more a function of the
indentation, to me, then of a specific character I have to pick out.

If the code isn't indented properly, well, then, the alignment of
whatever you do vertically doesn't matter much, eh?

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] PHP Standard style of writing your code

2006-04-29 Thread Porpoise


Rafael [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]


P.S. What, in your mind, is the advantage of replying after quoting the
original message and not before? :)

In an NG environment, it allows everyone to follow the logic and see clearly 
what is being replied to, in the correct context.


IMALOOPHO... 


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



Re: [PHP] PHP Standard style of writing your code

2006-04-29 Thread Robert Cummings
On Sat, 2006-04-29 at 03:17, Richard Lynch wrote:

 I'll also respond to another poster:
 
 I personally have no less/more ease in aligning } with a logic
 statement or with another {, *IF* the code is indented properly.
 
 In other words, the vertical alignment is more a function of the
 indentation, to me, then of a specific character I have to pick out.
 
 If the code isn't indented properly, well, then, the alignment of
 whatever you do vertically doesn't matter much, eh?

Tis true, I think mostly I just prefer the visual appeal of v-aligned
braces, as you prefer visually the other. I used your style for about 7
years before I switched, and now for whatever internal appraisal reasons
I just find the inline style messy looking :) Although, I'll take it any
day over some of the other styles I've seen.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] PHP Standard style of writing your code

2006-04-29 Thread Satyam

On Sat, 2006-04-29 at 03:17, Richard Lynch wrote:


I'll also respond to another poster:

I personally have no less/more ease in aligning } with a logic
statement or with another {, *IF* the code is indented properly.

In other words, the vertical alignment is more a function of the
indentation, to me, then of a specific character I have to pick out.

If the code isn't indented properly, well, then, the alignment of
whatever you do vertically doesn't matter much, eh?


I prefer the opening brace at the end of the line as well.  I rather see as 
much of the code as possible.  Wasting one line for an openning brace, and 
not only function declarations but any opening brace, is a waste of screen 
space.  My eyes are no longer good enough to have microscopic screen 
resolutions so within the resolution I use plus all the toolboxes, I still 
want to be able to see a good chunk of the code.


For me, the visual consequence of an opening brace is the indentation of the 
line following it.  The brace by itself is just what tells the compiler to 
start the statement block.  The visual clue, for me, is the indentation, 
something I am very strict about. The compiler cannot read indentations. 
So, since the brace is for the benefit of the compiler, not mine, I don't 
devote a whole line to it.  Braces for the compiler, indentation for me.


And it is not that I don't like to waste space in general, I am generous 
with my lines before the function declaration or any other place where I 
feel it deserves it for clarity.  In C I put one or more blank lines in 
between the local variable declaration and the first executable, that is a 
space that is worth for clarity sake.  I would also put spaces before a 
#ifdef or after a #endif, those are spaces that say something to me.


A brace on its own line doesn't make sense to me.

Satyam

Satyam

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



Re: [PHP] PHP Standard style of writing your code

2006-04-29 Thread Rafael
	Thanks for your reply.  Paul Novitski already talked with me about it 
(in private), and my conclusions were...

-
	I guess that has something to do with the way *I* read my mails, since 
I'm usually aware what people are talking about (since I've wrote the 
one they're responding, or I've been following the thread)


	I think you have a pretty good reason, but I also think it doesn't work 
for me --since I have to skip the whole message I've already read, or 
what I wrote :)  Thanks for your answer (and so fast)

-
	I guess this is just one more of the too-many-already debatible points 
out there.  At the end, is a matter of taste, I can't see any as the 
right nor wrong option.


PS	I'd ask you a favor: do not include the email in the quotation, since 
these message are usually available (via http) in some sites, and having 
my email there makes a lot easier for me to get (even) more spam

PPS WTF is IMALOOPHO?

Porpoise wrote:
Rafael email-was-here wrote in message 
news:[EMAIL PROTECTED]


P.S. What, in your mind, is the advantage of replying after quoting the
original message and not before? :)

In an NG environment, it allows everyone to follow the logic and see 
clearly what is being replied to, in the correct context.


IMALOOPHO...

--
Atentamente,
J. Rafael Salazar Magaña
Innox - Innovación Inteligente
Tel: +52 (33) 3615 5348 ext. 205 / 01 800 2-SOFTWARE
http://www.innox.com.mx

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



RE: [PHP] PHP Standard style of writing your code

2006-04-29 Thread tedd

At 2:12 AM -0500 4/29/06, Richard Lynch wrote:

But I'm totally serious here -- I made this decision in college circa
1981, and I wrote the same long program both ways, and hung the two
versions up on the wall side-by-side, and I liked the one with { on
the same lines better.

I even solicited my non-programmer roommates' opinions, and they also
preferred the braces on the same line as ASCII art.


Well, that settles it -- if non-programmers like it, then it must be 
correct. :-)


It reminds of a time where a large oil company's Geophysicist was 
evaluating other consulting Geophysicist's work (I was one -- see 
http://geophysics.com ). He took our work product (highly technical 
seismic displays) and hung them on a wall and had everyone in the 
office (accountants, secretaries, UPS delivery man, etc.) parade by 
and pick the display they thought looked the best. To the winner, he 
awarded a multimillion dollar contract!


It had to be the worst way to evaluate a Geophysicist I have ever witnessed.

---

I daresay an experienced programmer is going to pick the style they
prefer as prettier.


I don't know about prettier, but I certainly strive that every piece 
of code I write to have a consistent style that I recognize as mine. 
Plus, when I see another programmer use the same style, I naturally 
assume that he's very intelligent. :-)


Additionally, the style I've developed cuts across several languages 
I've known.


--

Though it would be an interesting experiment for some psychology
student to A/B compare with programmers, non-programmers, experienced
programmers, etc...


That may be an interesting study as to how we perceive and solve 
problems -- anal-retentive vs the free-will types and all variations 
in between. Each, I am sure, has their place in the overall scheme of 
things.


But, I will pass on to the group here that I have noticed (over the 
last 40 years ) in my programming that the size of my monitor is 
generally in direct relationship with the size of my functions.


In addition, the larger my monitors, the more white space I use in 
making my code pretty and documented. In my view, there is no 
wasted space -- just a way to reduce my confusion.


tedd
--

http://sperling.com

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



Re: [PHP] PHP Standard style of writing your code

2006-04-29 Thread tedd

A brace on its own line doesn't make sense to me.

Satyam


As the old lady said, as she kissed the cow To each their own.

It make perfect sense to me to enclose all blocks of code within 
braces on their own line AND to indent that entire segment, like so.


function, if, while, switch, whatever...
  {
  // code
  }

But, like I said -- to each their own. The above just makes sense to 
me and that's what this entire thread should be about -- do whatever 
makes you comfortable and productive.


The last thing I would want is to have someone tell me what style I *must* use.

tedd
--

http://sperling.com

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



Re: [PHP] PHP Standard style of writing your code

2006-04-29 Thread Richard Lynch
On Sat, April 29, 2006 9:56 am, Satyam wrote:
 The compiler cannot read
 indentations.
 So, since the brace is for the benefit of the compiler, not mine, I

[pedantic]
Actually, a compiler could use indentation, and, in fact, compilers
for some languages do just that.
[/pedantic]

That style of language definitely sucks, imho, but let's not get THAT
far off-topic, eh?

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] PHP Standard style of writing your code

2006-04-29 Thread Miles Thompson

At 03:19 AM 4/29/2006, Robert Cummings wrote:


On Sat, 2006-04-29 at 02:08, Paul Novitski wrote:
  IMHO, vertical aligned brackets can be messy when nesting
 relatively-small blocks (and seems to me like a lot of wasted space)

nsip
 like a use, not a waste.

 OK, OK, I'll stop.  Think I'll go out and get wasted~

Drink with friends... that way you have someone to brace you when you're
fall down drunk.

Cheers,
Rob.


Poorstyle:

drunken(){
echo Lopsided me;
}

Goodstyle:

drunken()
{
echo Supported me;
}

But the question arises, in goodstyle - should one indent the braces?

I used to code goodstyle, more and more it's poorstyle - nad the 
computer doesn't care, and Ultraedit can match braces, which helps when I 
get lost. I wish UE would also fold code.


With tongue firmly in cheek - cheers - Miles



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.1.385 / Virus Database: 268.5.1/327 - Release Date: 4/28/2006

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



Re: [PHP] PHP Standard style of writing your code

2006-04-29 Thread Robert Cummings
On Sat, 2006-04-29 at 10:56, Satyam wrote:

 A brace on its own line doesn't make sense to me.

This begs the question... Where do you place the closing brace?

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] PHP Standard style of writing your code

2006-04-29 Thread D. Dante Lorenso



So no matter what was actually typed, *I* would see:

function foo ($x) {
  //body
}

but some heretic who doesn't know any better would see:
function foo($x)
{
  //body
}

Now *THAT* would be a feature worth paying for in an IDE! :-)



Without caring what style you prefer, the correct reply to this request 
is the following:


   You seek a Code Beautifier for PHP.

I have found that only some IDE/Editor software contains such a beast.  
The convention for most software code editing tools is to have Shift + 
Ctrl + F do code formatting.  I use PHP Eclipse to handle all my code 
formatting.  It will allow you to choose your preference for braces up 
or down etc.


However...you may need to make a policy in your company.  If you use 
source control for your software, it may see changes in formatting as a 
distinct major revision.  Therefore, if you save code in your style 
and another developer opens the file and resaves in his style, then 
you'll unnecessarily make version control a nightmare.  Despite personal 
preference, you MUST adhere to the style of the project.  If you are the 
sole developer, you define that style.  If you are a coding monkey, then 
you may have to suffer with the style that the architect before you 
declared.


I can't work unless the code is formatted to my liking.  I'm the OCD 
type of programmer.  Luckily I'm also in control of coding standards 
within my company, whew!  Get PHP Eclipse and do a general search for 
PHP Code Beautifier then download some you like and try them out.


Beautiful code often contains fewer bugs.

Dante


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



RE: [PHP] PHP Standard style of writing your code

2006-04-28 Thread Chris W. Parker
Richard Lynch mailto:[EMAIL PROTECTED]
on Monday, April 24, 2006 11:50 PM said:

 So no matter what was actually typed, *I* would see:
 
 function foo ($x) {
   //body
 }
 
 but some heretic who doesn't know any better would see:
 function foo($x)
 {
   //body
 }
 
 Now *THAT* would be a feature worth paying for in an IDE! :-)

Setting aside the fact that you're completely wrong about your preference... ;)

What, in your mind, is the advantage to putting the opening brace on the same 
line as the function call, logic statement, etc.? (Btw, this is a serious 
question!)



Chris.

p.s. Yes I'm still alive. Just haven't been able to work on any web related 
stuff for a long time here are work. :( The downside of being the IT department.

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



RE: [PHP] PHP Standard style of writing your code

2006-04-28 Thread Robert Cummings
On Fri, 2006-04-28 at 18:18, Chris W. Parker wrote:
 Richard Lynch mailto:[EMAIL PROTECTED]
 on Monday, April 24, 2006 11:50 PM said:
 
  So no matter what was actually typed, *I* would see:
  
  function foo ($x) {
//body
  }
  
  but some heretic who doesn't know any better would see:
  function foo($x)
  {
//body
  }
  
  Now *THAT* would be a feature worth paying for in an IDE! :-)
 
 Setting aside the fact that you're completely wrong about your preference... 
 ;)
 
 What, in your mind, is the advantage to putting the opening brace on the
 same line as the function call, logic statement, etc.? (Btw, this is a
 serious question!)

You know what they say...

Job security through code obscurity!

And no, I don't know who they are :) I'm in the vertically aligned
brace camp. It's just cleaner when the braces line up because you can
pick out the beginning and end of the block easier... doubly so when you
have a long conditional that wraps... KISS baby!

 p.s. Yes I'm still alive. Just haven't been able to work on any web related
 stuff for a long time here are work. :( The downside of being the IT
 department.

Good to see you again! :)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] PHP Standard style of writing your code

2006-04-28 Thread Rafael

IMHO, vertical aligned brackets can be messy when nesting
relatively-small blocks (and seems to me like a lot of wasted space)
A couple of facts of my codding style:
- I tend to always use brakets, so I ignore the fact that single
  lines/actions can be written without brackets,
- I try not to let lines grow larger than about 100 cols (cannot
  be really done with strings and other thingies, and maybe that
  should remain in the old 80 cols, but it's too litle space), and
- I use a 4 space indentation, and that alone suffices for making
  a block stand clear enough

So, in my case, the code would be something like
  function foo( $x ) {
  // body...
  }
  ···
  $a = foo($b);

Chris W. Parker wrote:

So no matter what was actually typed, *I* would see:

function foo ($x) {
 //body
}

but some heretic who doesn't know any better would see:
function foo($x)
{
 //body
}

[···]

Setting aside the fact that you're completely wrong about your
preference... ;)

What, in your mind, is the advantage to putting the opening brace on
the same line as the function call, logic statement, etc.? (Btw, this
is a serious question!)

[···]
P.S.	What, in your mind, is the advantage of replying after quoting the 
original message and not before? :)

--
Atentamente,
J. Rafael Salazar Magaña
Innox - Innovación Inteligente
Tel: +52 (33) 3615 5348 ext. 205 / 01 800 2-SOFTWARE
http://www.innox.com.mx

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



RE: [PHP] PHP Standard style of writing your code

2006-04-25 Thread Nicolas Verhaeghe
From: Martin Zvarík [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 24, 2006 10:51 PM
To: PHP
Subject: [PHP] PHP Standard style of writing your code


Hi,
I see everyone has its own way of writing the code. If there is 10 
programmers working on same thing, it would be good if they would have 
same style of writing the PHP code.

So, my question is: Is there anything what would define standard style 
of writing PHP code?

Thanks,
Martin

--

Again: all caps. PHP will think you're yelling at him and will work faster.

Seriously, if you use the same editor, and if it includes a source code
formatter, just use it.

Usually such editors will auto-indent.

It's usually common practive in PHP to never capitalize anything and to keep
it all lower-case, except for server objects like FORM, GET, etc..

Another good thing to remember is that English is our common language and
that it is usually a good practice to give variables an English name.

In ASP, capitalization is cool, for instance: Response.Write
TextFormatter(strBlahBlah)

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



Re: [PHP] PHP Standard style of writing your code

2006-04-25 Thread Richard Lynch
On Tue, April 25, 2006 12:51 am, Martin Zvarík wrote:
 I see everyone has its own way of writing the code. If there is 10
 programmers working on same thing, it would be good if they would have
 same style of writing the PHP code.

 So, my question is: Is there anything what would define standard style
 of writing PHP code?

Yes, but...

You can lock down every single little nuance of PHP style and document
it all somewhere and require that all 10 programmers use THAT style.

There are two possible outcomes to this:

#1. Somebody actually enforces this document, and makes themselves
REAL unpopulare, and probably all 10 programmers very unhappy, and
they all quit.

#2. Nobody actually enforces it; nobody follows it; you wasted time
making it.

The best general rule is probably to follow the style the original
author used, as much as possible, when adding to or changing a file.

The differences between placement of { and newlines and spaces and
parentheses are pretty much a religious argument, not a technical
argument, no matter how much people try to claim one is superior for
readability.

Hmmm.  It would be Really Nifty if some fancy IDE out there would
automatically render one's PHP code in the style preferred by the
developer...

So no matter what was actually typed, *I* would see:

function foo ($x) {
  //body
}

but some heretic who doesn't know any better would see:
function foo($x)
{
  //body
}

Now *THAT* would be a feature worth paying for in an IDE! :-)

Forget the stupid color-coding of the fucntions and all that crap. 
Gimme the code layout I want!

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] PHP Standard style of writing your code

2006-04-25 Thread Dave Goodchild
Chcek out the PEAR site for a pretty good style, but then again it is a
matter of preference and I code any way I choose unless I am working within
a team where some kind of consistency makes sense.

On 25/04/06, Martin Zvarík [EMAIL PROTECTED] wrote:

 Hi,
 I see everyone has its own way of writing the code. If there is 10
 programmers working on same thing, it would be good if they would have
 same style of writing the PHP code.

 So, my question is: Is there anything what would define standard style
 of writing PHP code?

 Thanks,
 Martin

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




--
http://www.web-buddha.co.uk

dynamic web programming from Reigate, Surrey UK (php, mysql, xhtml, css)

look out for project karma, our new venture, coming soon!


Re: [PHP] PHP Standard style of writing your code

2006-04-25 Thread T.Lensselink
 Hi,
 I see everyone has its own way of writing the code. If there is 10
 programmers working on same thing, it would be good if they would have
 same style of writing the PHP code.

 So, my question is: Is there anything what would define standard style
 of writing PHP code?

 Thanks,
 Martin

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



Read the PEAR coding standards : http://pear.php.net/manual/en/standards.php
Think coding style is personal for everybody.

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



Re: [PHP] PHP Standard style of writing your code

2006-04-25 Thread Satyam
- Original Message - 
From: Richard Lynch [EMAIL PROTECTED]




On Tue, April 25, 2006 12:51 am, Martin Zvarík wrote:

I see everyone has its own way of writing the code. If there is 10
programmers working on same thing, it would be good if they would have
same style of writing the PHP code.

So, my question is: Is there anything what would define standard style
of writing PHP code?


Yes, but...

You can lock down every single little nuance of PHP style and document
it all somewhere and require that all 10 programmers use THAT style.

There are two possible outcomes to this:

#1. Somebody actually enforces this document, and makes themselves
REAL unpopulare, and probably all 10 programmers very unhappy, and
they all quit.

#2. Nobody actually enforces it; nobody follows it; you wasted time
making it.

The best general rule is probably to follow the style the original
author used, as much as possible, when adding to or changing a file.

The differences between placement of { and newlines and spaces and
parentheses are pretty much a religious argument, not a technical
argument, no matter how much people try to claim one is superior for
readability.

Hmmm.  It would be Really Nifty if some fancy IDE out there would
automatically render one's PHP code in the style preferred by the
developer...

So no matter what was actually typed, *I* would see:

function foo ($x) {
 //body
}

but some heretic who doesn't know any better would see:
function foo($x)
{
 //body
}

Now *THAT* would be a feature worth paying for in an IDE! :-)

Forget the stupid color-coding of the fucntions and all that crap.
Gimme the code layout I want!

--


The Php compiler http://www.phpcompiler.org/ might help you with 
reformatting. Look at: http://www.phpcompiler.org/doc/convertingphp.html. 
If you add no extra code to the compiler, it will produce a reformatted 
version of the original.  I don't know it your IDE allows it but in the 
plain editor I use I could assign an external program to run, modify the 
source in the foreground and reload it once done.


Satyam

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



Re: [PHP] PHP Standard style of writing your code

2006-04-25 Thread tedd

Hmmm.  It would be Really Nifty if some fancy IDE out there would
automatically render one's PHP code in the style preferred by the
developer...

So no matter what was actually typed, *I* would see:

function foo ($x) {
  //body
}

but some heretic who doesn't know any better would see:
function foo($x)
{
  //body
}

Now *THAT* would be a feature worth paying for in an IDE! :-)

Gimme the code layout I want!



Actually, if I remember correctly, Macromedia Flash IDE does just 
that. You determine what layout style you want and it complies.


As for style, I personally like:

function myFunction($x)   // dislike foo
{
// body
}

In fact, I indent all blocks, but then again, I don't know any 
better. Been there more than once. :-)


tedd
--

http://sperling.com

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



Re: [PHP] PHP Standard style of writing your code

2006-04-25 Thread Ahmed Saad
On 4/25/06, Richard Lynch [EMAIL PROTECTED] wrote:
 Now *THAT* would be a feature worth paying for in an IDE! :-)


Well, you actually don't have to pay anything. TruStudion PHP
foundation version (read free/open source version) has a decent code
formatter and a pretty neat editor: argument order, code completion
and insight working with PHP 4 and 5 (unlike PHPEclipse), code 
templates, ...

http://www.xored.com/trustudio


Regards,
Ahmed