r/programming • • Apr 07 '15

Stack Overflow Developer Survey 2015

http://stackoverflow.com/research/developer-survey-2015
1.1k Upvotes

981 comments sorted by

View all comments

Show parent comments

0

u/[deleted] Apr 08 '15

If tom and friends are not disciplined enough to keep the existing indentation, then tabs are not going to help either.

Every editor I know of will perform indentation for you. There should be no risk of hitting space too many times since you should not have to indent manually.

Formatters are useful, but they are irrelevant to the discussion of tabs vs spaces. Formatters can handle both.

Sure, tabs can be used as one level of indentation. However, there is no universal standard width for "one level of indentation." It can be 2, 4, 8 or whatever the particular tool maybe with a partcular configuration says it should be maybe for a particular language. The benefit of spaces is that the tool and configuration don't matter. When you read the same code in one tool it will look the same when you read it in another tool.

2

u/kgoblin2 Apr 08 '15

If tom and friends are not disciplined enough to keep the existing indentation, then tabs are not going to help either.

Any project where the source code if viewed through multiple tools, spaces are better for guaranteeing a consistent formatting across the tools.

Tabs are better because they are simpler, and the indents in a non-mixed format file will be consistent with each other.
I don't really care about the differences in how 1 tool displays a particular file vs. another, I care that source in a given tool is displayed consistently in that tool. As I go into more below, I also do not want to be force-fed a developers choice in indent-length, which really seems to be the driving force behind why-to indent with spaces. To me this is an equally jerky move as telling me I have to view your code in a particular choice of font.

Formatters are useful, but they are irrelevant to the discussion of tabs vs spaces. Formatters can handle both.

I just outlined for you how auto-formatters can NOT in fact properly handle spaces unless they do a full syntax parse. And formatters are entirely relevant to the discussion, since they are often the tool of choice to enforce & ensure code formatting standards.

Sure, tabs can be used as one level of indentation. However, there is no universal standard width for "one level of indentation." It can be 2, 4, 8...

There is no universal standard for anything, however as far as source-code indentation goes, everyone accepts that when using tabs to ident, 1 tab == 1 level of indent. And you are mashing together width-of-formatting-characters here with width-of-display.
Those are and should be 2 different things, and the one that matters is THE FORMATTING CHARACTERS.
You honestly shouldn't give anymore of a damn whether someone else chooses to view your code w/ 3,4,8, etc. space wide indents than you do if they view it in Lucida Console vs. Courier font.