Post #231,738
10/31/05 4:07:50 PM
|
Yes, we know you're strongly imprinted
That isn't an actual argument, nor is it research (which is what I'm really interested in seeing).
Regards, Ben
I have come to believe that idealism without discipline is a quick road to disaster, while discipline without idealism is pointless. -- Aaron Ward (my brother)
|
Post #231,748
10/31/05 5:05:16 PM
10/31/05 5:08:27 PM
|
I'm interested in research too
so I can stop arguing this with the "wrong" people.
Sadly, I've never found any. Which seems odd as it might be fertile ground for a doctorate.
I have lots of anecdotal experience that suggests that the right style (BSD) is best though. Some of this is from teaching programming and helping students understand their programs. Often, simply fixing brace placement/reindenting gives them the insight they need to fix their programs.
Some of it is from code statement nesting errors I've either found and fixed or helped find with someone (pair debugging) who uses the wrong style (to pick a name to differentiate it from the "right" style).
I think a worthwhile experiment would be to take a bunch of source code and either double or remove braces arbitrarily, present them to developers and time how long it takes them to spot the error.
"Whenever you find you are on the side of the majority, it is time to pause and reflect" --Mark Twain
"The significant problems we face cannot be solved at the same level of thinking we were at when we created them." --Albert Einstein
"This is still a dangerous world. It's a world of madmen and uncertainty and potential mental losses." --George W. Bush
|
Post #231,752
10/31/05 5:22:53 PM
|
so K&R is wrong? Heretic BURN HIM!
"the reason people don't buy conspiracy theories is that they think conspiracy means everyone is on the same program. Thats not how it works. Everybody has a different program. They just all want the same guy dead. Socrates was a gadfly, but I bet he took time out to screw somebodies wife" Gus Vitelli
Any opinions expressed by me are mine alone, posted from my home computer, on my own time as a free american and do not reflect the opinions of any person or company that I have had professional relations with in the past 49 years. meep questions, help? [link|mailto:pappas@catholic.org|email pappas at catholic.org]
|
Post #231,804
10/31/05 10:45:07 PM
|
:-\ufffd :-\ufffd :-\ufffd :-\ufffd
jb4 shrub●bish (Am., from shrub + rubbish, after the derisive name for America's 43 president; 2003) n. 1. a form of nonsensical political doubletalk wherein the speaker attempts to defend the indefensible by lying, obfuscation, or otherwise misstating the facts; GIBBERISH. 2. any of a collection of utterances from America's putative 43rd president. cf. BULLSHIT
|
Post #231,756
10/31/05 5:28:23 PM
|
There's a lot of stuff at scholar.google.com
I'm not sure how well it would satisfy partisans though. I haven't come across a study of the benefits of brace placement rules, but there are things like [link|http://research.sun.com/people/mlvdv/COM.sun.mlvdv.doc.ist_02.paper_pdf.pdf|this] 17 page .pdf by Van De Vanter at Sun: pp.1-2: Unlike the textual representation of linguistic structure, which includes keywords, identifiers, operators, and punctuation, documentary structure consists of those textual aspects explicitly defined to be not part of the language: white space (new lines, spaces, tabs), comments, and choice of names.
Viewed differently, documentary structure is what programmers add to source code for the sole purpose of aiding the human reader. This is of enormous importance because of the central role of reading during software development [14]. Programmers clearly understand this: they arrange code carefully, complain about inadequate comments, and argue passionately about the exact placement of braces in code (purely a matter of white space in most languages).
It is almost tautological that documentary structure is outside the formal language. It is a much more subtle fact that documentary structure is mostly orthogonal to language structure. An important consequence is that compiler-oriented tools do not represent documentary structure adequately. Compilers discard this information freely because it is not needed: humans seldom read compiler output. For other language-based tools, however, losing documentary structure violates the tool builder\ufffds equivalent of the physician\ufffds oath to \ufffdfirst do no harm.\ufffd Cheers, Scott.
|
Post #231,786
10/31/05 9:48:21 PM
|
I think it depends on your visual habits.
I'm into white-space and correct indents, so I use the K&R brace-style. It also means I like spaces around my = signs, and after commas and around expressions in if, while, switch, etc.
And I know I'm extremely partial to Vim's syntax highlighting... :-)
Wade.
"Insert crowbar. Apply force."
|
Post #231,856
11/1/05 9:29:21 AM
|
Sidenote
most of the arguments on this are based on the fact that most code isn't adaptable to the bracing style the individual prefers.
BUt i was using (god, can't remember the name now....) jalopy with Java and multiple programmers. I prefer White style, one prefers K&R, etc. Get the code, run it through jalopy, update the changes, push it back to the "standard style" and be done.
My only other comment is that certain language features (anonymous classes in Java for one) seem to favor certain bracket styles (K&R).
|
Post #231,859
11/1/05 9:37:17 AM
|
Automate that Jalopy
CVS allows you to run processes (like, say, Jalopy) when checking code in. Set this process up, create a team-agreed-upon standard style of formatting code, and then whenever you check code in, it will automatically be reformatted to project standards, no matter how it was coded.
If you'd like to know the steps to do this, I'll go look up the reference I used to get it done for our project a few months back. Let me know.
-YendorMike
"They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." - Benjamin Franklin, 1759 Historical Review of Pennsylvania
|
Post #231,861
11/1/05 9:44:25 AM
|
That's okay...
- We're on ClearCase (employer required) -- ClearCase does allow for scripts to run on check-in also
- That project was a while ago...onto other things. <shrug>
|
Post #231,866
11/1/05 9:59:47 AM
|
np
Every company is different, and we've all got our own unique requirements.
-YendorMike
"They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." - Benjamin Franklin, 1759 Historical Review of Pennsylvania
|
Post #231,877
11/1/05 11:14:00 AM
|
Yes, that's a PBP recommend :-)
The Perl equivalent is perltidy.
Formatting each to his own style is great for shared source code. But somehow it seems that people wind up seeing the default format more often than you'd expect. And so will argue about it. *shrug*
Cheers, Ben
I have come to believe that idealism without discipline is a quick road to disaster, while discipline without idealism is pointless. -- Aaron Ward (my brother)
|