I don't know who you are Frank..
But I understand and support you entirely.. I could write my own 1500 word post like you.. But you've covered it all I always see the { } pair used when there is only one statement, and also this weird if(expression) { statement } else { statement 2 } blocks are VERY weird and hard to understand. I prefer and use for every lang. Including C++, Object Pascal, java, PHP, Perl: if(expression) { statement block if(expression2) { statementblock 2 } } else { statement if } in a text editor these blocks are easily read and the double spacing (not tabs) I use makes it REALLY easy to find and track code during debugging.. sometimes I see loops in conditional statements mixed with functions and this neverending mass of curly braces and I am very confused trying to fix their code.. SO I try as hard as possible so suggest my method as it makes reading much easier.. I do understand where you are coming from with your starting { being in line with the actual expression it refers to... Hmm yes but as I always indent for loops, conditional expressions, etc.. anything that needs curly braces I will easily see that if the code doesn't return back to the first column something is wrong Eg.. if(exp1) { if(exp2) { ..do that.. } else { while(x<y) { ..do this.. } } } and I can clearly see the last brace finishes again on col 1.. SO i know all is good.. Hard in email to show as the character spacing is not equal like good text editors.. but paste it in your editor you'll see what I mean.. Thanks for your support.. Should have more people following these readable standards in the world! ::::::::::::::::::::::::::::::::::::::::::: : Julien Bonastre [The-Spectrum.org CEO] : A.K.A. The_RadiX : [EMAIL PROTECTED] : ABN: 64 235 749 494 : QUT Student :: 04475739 ::::::::::::::::::::::::::::::::::::::::::: > > ----- Original Message ----- > From: "Frank" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Sunday, April 21, 2002 11:51 AM > Subject: [PHP] Better standards in PHP-coding > > > > "The nice thing about standards is that there are so many to choose > between". > > Subject: Uses of block markers in coding > > GNU recommends a standard with block-markers aligned under each other and > a > number of people - including myself - find it senseless and > counter-progressive to keep up an older standard resting from old days and > doing the programmer a disfavor. > > Too many programmers continue to use a style that originates back to the > days where dumb terminals with one-line memory and line-editors was > common. > > Those days it could take long time to submit a line to the mainframe. I > have tried it myself and in worst-case situations it could take up to half > a minute to submit a line. > > So naturally we put more things into one line. Statements like > > if (tempratureM1>=tempratureSTP) {cout << "Warning! Cooling needed"; > log(tempratureM1, "Warning);}; > > all in one line. > > When editors became a little faster people started to write: > > if (tempratureM1>=tempratureSTP) { > cout << "Warning! Cooling needed"; log(tempratureM1, "Warning); } > > which is nicer to look at but would take many seconds more as one more > line > has to be submitted. > > - - - > > Nowadays few people have any problems with waiting for a CR. > > But for mysterious reasons a rest from the old forced "standard" remains > among people who use C(++) like languages. > > It is still standard to write > > if (some_expression) { > statements; > ... > } > > What the "{" - the marking of the beginning of a block that should be > indented - is doing in the end of the line nobody has yet been able to > explain me. > > Why, then, are functions not written as > > function foo(parameter1, foo(parameter1, parameter2, ... parameterN) { > statements > ... > } > > ? > > In other block-structured languages you of course align block-markers > under > each other, allowing for easy scan. > > if expression > begin > statement; > ... > ... > end; > > I have yet to see anybody write > > if expression begin > statement; > ... > ... > end; > > - - - > > Does it matter? Oh, yes it does. A lot. As teacher I know from experience > that programmers has a harder time tracking their own block with a number > of "{"s dancing far out of sight in the right side of the screen. This is > not a matter of experience. No experience can ever make it equally fast to > control structures based on vertically aligned block-markers contra those > where the marker can be found anywhere on a line. > > As an amusing result of the weird practice it has been necessary to > recommend a standard where the { }-pair is always used, even though there > is only one statement following an if: > > if ($myvarirable1*myvariable2 >= myvariable3*myvariable4+114) { > oneStatement; > } > > instead of simply > > if ($myvarirable1*myvariable2 >= myvariable3*myvariable4+114) > oneStatement; > > > Why the need for the extra "{ }"s? > > Of course because the the difference between > > if ($myvarirable1*myvariable2 >= myvariable3*myvariable4+114) > oneStatement; > > (correct) and > > if ($myvarirable1*myvariable2 >= myvariable3*myvariable4+114) { > oneStatement; > > (wrong) is easily overlooked because of the block marker put away to the > right! > > > But nobody overlooks the difference betweeen > > if ($myvarirable1*myvariable2 >= myvariable3*myvariable4+114) > oneStatement; > > and > > if ($myvarirable1*myvariable2 >= myvariable3*myvariable4+114) > { > oneStatement; > > > where the missing "}" shines in the eyes. > > - - - > > We can only hope that some major standard-setters for PHP should make a > rational decision about what standard to choose and not just keep "what we > are used to" for the disadvantage of future generations of programmers. > > http://www.gnu.org/prep/standards.htm > http://cs.nmhu.edu/personal/curtis/cs1htmlfiles/essentialssec6.htm > > > Best regards > > SFM > U5com Co Ltd. > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php