coding completely

August 16th, 2001

Chris points to some code indentation styles.

I’m definitely a K&R style braces/indentation guy. Also, I’m a two-space guy. Two spaces is just enough to show you structure, doesn’t make line lengths crazy, and is easy to enter/delete when typing.

What about the tabs argument? I absolutely prefer to use spaces and not tabs, and I set up my editors to replace tabs with spaces. I find that otherwise, in a project touched by a few people, you get some tabs, some spaces, and it looks different and/or broken in everyone’s editor with different tab-size settings. Use spaces and it will always look the same. Editors these days are smart enough to tab two spaces and indent and outdent blocks etc without tab characters in the code.

I’ve converted some hardcore tab guys on this issue. Takes them a while, but pretty soon they can’t find any real reason to use tabs instead of spaces in code. I’d be glad to hear of any show-stopping reasons in favour of tabs, though.

Comments are closed.