Jeroen Wenting: In a few years you'll agree with most of us that underscores do nothing to make code more readable, all they do is make names longer than they need be. Maybe Stefan will. I used camelCase for several years at jobs where it was the de facto standard, and for me underscores still improve legibility by functioning almost like spaces between the words. They also permit an additional style of capitalization.
Ummmm, no, check the source. The text you enter gets HTML inserted into it by the UBB program. If it didn't, most whitespace would be stripped as you say. For some reason UBB uses a <br /> at the end of every line that's not completely blank, but it uses a <p> in place of a completely blank line, replacing two consecutive <br /> tags. IE displays <p> and <br /> the same way, while the other browsers insert an extra line for <p> since the <p> represents the start of a new paragraph. I'm not aware of a clear spec on how paragraphs are to be displayed, so I'd say it's UBB's fault for generating inconsistent HTML.
I've just hacked the UBB code to try to get it to display things a bit more consistently, using <br /> at the end of each line. So hopefully this will work better in the future. So in the future, blank lines in code should display as blank lines, even if you're using IE. Or maybe not; there's probably some other side effect I haven't noticed yet. (Crossing fingers...) [ May 13, 2004: Message edited by: Jim Yingst ]
[MG]: It's clear from both the examples and the wierd rationale shown in Chicken Coop style section 2.2 that literals as well as identifiers are to be surrounded by spaces.
No, the text refers only to identifiers, and there are numerous examples showing literals (integer and String) which are not surrounded by whitespace. As for the rationale - um, no comment.
[MG]: Do you think the spaces before the commas improve the code
Not particularly. I prefer to use commas the way we've grown used to seeing them everywhere else. Also I think that excessive whitespace diminishes its usefulness when you actually want to set something apart by giving it extra space.
[MG]: Have you even seen the first style in wide use outside the Cattle Drive?
No. Only at my current job, and that's a special case, since I got the job through the Coop style guide author. [ May 13, 2004: Message edited by: Jim Yingst ]
I've just hacked the UBB code to try to get it to display things a bit more consistently, using <br /> at the end of each line. So hopefully this will work better in the future. So in the future, blank lines in code should display as blank lines, even if you're using IE. Or maybe not; there's probably some other side effect I haven't noticed yet.
Thanks for that fix Jim, much appreciated. I tested it, and it works. I look at my own code and I cry, touched by the elegance of those empty lines. I was considering putting an end to my JR membership because of that nasty bug, but now I am bound forever.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop