The Facts Behind the Code Indention Style War
experimentgarden.blogspot.com
The Facts Behind the Code Indention Style War
1–10 of 29 posts
Re: The Facts Behind the Code Indention Style War
#2Go Tom, great stuff. Now all we've got to do convince is teach you to space it all out so I can read it
I switched to Allman after that: much to the relief of many people ;)
Re: The Facts Behind the Code Indention Style War
#3I'd be interested in seeing some actual research into the relative usability and other factors of the various approaches. Until such time as someone proves it objectively one way or the other I'll use what I'm familiar with (K&R) in private code and the house style in the day job.
Re: The Facts Behind the Code Indention Style War
#4I always used to use K&R style and I think it teaches bad habits: I used to obsess about compressing code. I remember when I started trying to help people with learning Python. A friend, and arguably better (python) programmer, commented: Go Tom, great stuff. Now all we've got to do convince is teach you to space it all out so I can read it I switched to Allman after that: much to the relief of many people ;)
Having used python and small amounts of lisp, I also flirted with rolling up all the close parens/braces on the end of lines with no white space.
Re: The Facts Behind the Code Indention Style War
#5I'm not worried about obsessing about compact code; this style just looks best to me. I'm consistent with my formatting, so I can glance at my code and know what I'm looking at. Actually, I can literally unfocus my eyes and I still know if I'm looking at a function, control structure within a function, or a class definition.
The important part, where taste comes in, is where code gets separated by empty lines. I consider code separated by empty lines akin to paragraphs.
For the reocrd, my indent settings:
-br -brs -nbfda -npsl -npcsRe: The Facts Behind the Code Indention Style War
#6Re: The Facts Behind the Code Indention Style War
#7[FWIW, both examples suck. Use a case or switch statement.]
Re: The Facts Behind the Code Indention Style War
#8I always used to use K&R style and I think it teaches bad habits: I used to obsess about compressing code. I remember when I started trying to help people with learning Python. A friend, and arguably better (python) programmer, commented: Go Tom, great stuff. Now all we've got to do convince is teach you to space it all out so I can read it I switched to Allman after that: much to the relief of many people ;)
Re: The Facts Behind the Code Indention Style War
#9Re: The Facts Behind the Code Indention Style War
#10And ultimately, consistency is most important. Your "style" only matters when you're starting your own project; I really hate it when people let their personal disagreements chop up a source file.