Email
Password
Remember meForgot password?
    Log in with Twitter

article imageProgrammers who use spaces instead of tabs make more money

By James Walker     Jun 16, 2017 in Technology
Programmers who indent their code using space characters make more money than those using a single tab. The surprising discovery was made after scrutinising survey data. It has astounded the survey creators who are unable to explain the trend.
The seemingly simple fact was found in the raw data from Stack Overflow's 2017 Developer Survey. 28,657 programmers responded to the question asking whether they use spaces or tabs. Spaces were marginally more popular at 41.8 percent compared to 40.7 percent for tabs. The remaining respondents use a mixture of formats.
Out of the question respondents, 12,426 people provided the salary they receive from their programming jobs. Comparing this data with the number of people using tabs and those with spaces, an unexpected and baffling trend emerges. Stack Overflow found that programmers who use spaces to indent their code make considerably more money than tab advocates.
The totally unprecedented result confounded the survey analysts. Stack Overflow tried to find an explanation for the trend by assessing whether it appears in every country. It's possible that programmers in regions with a lower average income tend to use tabs, perhaps due to their coding education, therefore leading to an overall lower average salary for tab users.
Spaces/tabs and income graph
Spaces/tabs and income graph
Stack Overflow
This hypothesis proved to be incorrect though. The higher income for space users appears within all the countries with the largest number of survey respondents. Further analysis found the trend also persists between different kinds of programmer, such as web developers and people in system administration.
The question of using spaces or tabs is one of the longest running wars amongst programmers. There are several reasons for and against each indentation option and many developers have strong feelings on which is best. Although the tab key is used for either option, most text editors allow it to be remapped to insert a fixed number of spaces.
Some programming languages, such as Python, have syntax that's reliant on indentation. If the indentation of the code is wrong, the program won't run. Others, like PHP, don't care about indentation. It's only used to make the code more presentable, a visual aid for the developer.
Distribution of the trend by country
Distribution of the trend by country
Stack Overflow
The two ways of indenting code, either with multiple spaces or a single tab, is one of the most controversial arguments remaining in programming. In some instances, the language forces the developer to pick one of the systems. C requires tabs while the Python style guide advises spaces. In most commonly used languages, it's up to individual developers to choose though.
The "tab" character will indent code by multiple on-screen columns. This reduces the file size of the code as a typical indentation of two or four columns can be signalled with a single byte of data. By contrast, a space only indents the code by one column, so multiple characters are required for a full indentation.
Spaces have their advantages though, most notably consistent presentation across platforms. Because the number of columns inserted by a tab can vary among editors, encoding types and operating systems, a file formatted by tabs may not properly display in columns on other computers. Spaces will always be aligned correctly as their value is fixed at a single on-screen column.
Overall, Stack Overflow estimated that using spaces instead of tabs leads to an average of an 8.6 percent higher salary. This would appear to be a compelling reason for their use, although the cause of the strange trend remains unknown.
Suggestions in the comments on Stack Overflow's post include an idea that experienced programmers may be more likely to use spaces, perhaps after encountering problems with tabs. However, counterarguments point out that older developers could be more likely to use tabs because text editors that can translate the tab key to spaces are relatively new. Neither viewpoint is particularly compelling, implying there's another factor that's yet to be considered.
More about Programming, Coding, Code, programmers