|Tabs v Spaces - More Analysis|
|Written by Janet Swift|
|Monday, 17 July 2017|
The recent finding that developers who use spaces for indentation make more money that those who use tabs led to a few raised eyebrows and puzzled looks. Now reanalysis of the data finds further correlations.
The Tabs versus Spaces issue isn't likely to go away soon, especially as it's something developers tend to feel strongly about. The idea that rather than just a personal preference that developers on both sides will go to great lengths to defend, was explored in a blg post from David Robinson, which we reported last month.
Using data from the recent Stack Overflow survey, he found that
using spaces instead of tabs was worth as much as an extra 2.4 years of experience.
The passion that people show for whichever method of indentation they prefer has even been the basis for a storyline in Silicon Valley. If you missed it, this clip went viral last year:
What I find most amazing about this YouTube clip isn't that it has had 455,725 views but that it has had 464 comments, most of which are about the issues - which the short clip manages to summarize neatly.
The argument for tabs is avoiding keypresses and reducing storage requirements.
An argument against tabs is that they are more complex. All you need is an editor or and environment that doesn't understand tabs and the file is useless. There is also the small issue that tabs interact with the text in unpredictable ways. For example if the text has passed a tab stop then the tab is to the next one. This seems innocent until someone changes the tab positions when things can go wrong. The pro spaces lobby also points out that tabs settings can vary from machine to machine so spaces is better for consistency. It is about simplicity and control v trading space for complexity.
There's an ongoing poll on Opensource.com which shows Spaces marginally more popular than Tabs. The key result, however, is that "No strong preference" has only around 20% share.
The StackOverflow data is available for download and Eva Gabasova decided to look into it and try to shed some light onto the question of why spaces should equate to higher pay regardless of experience level.
Restricting her analysis to US developers she first compared the effect of including information about indentation method in the regression model and discovered that both the full model (with the information on tabs and spaces included) and the reduced model (without this information) explained about 40% of variance in salary. Looking to see which variables gained more significance in predicting salary in the reduced model she identified:
Sadly, there's no further mention of PHP, but this is a particularly low paying technology in the US according to the Stack Overflow 2017 survey, see Developer Pay Satisfaction According To Stack Overflow.
Gabasova's analysis finds that contributing to open source predicts a higher salary irrespective of experience.
Adding in information about indentation method show that spaces are only marginally more popular than tabs among the those in the US who are not involved in open source and that on a global basis tabs are more popular.
On the other hand, spaces are much more popular among those who contribute to open source, especially US devs.
At this point in her analysis, Gabasova writes:
I think we're getting closer to potential causal explanations here. The main advantage of using tabs is that you can set how they are displayed in the IDE, with spaces the layout is fixed. This means that the same code can look very different for different people if using tabs. And when people start mixing the two, one person using tabs and other using spaces within the same file, it leads to a mess. My theory is that when diverse people are working on open source projects together without enforced coding style, the possible formatting mess is nudging people towards using spaces simply because the code is consistent for everyone.
Plotting salaries based on open source contributions and indentation method shows this variation for US developers:
Junior developers using both tabs and spaces contributing to open source have a slightly higher median salary than people using spaces but not contributing. And open source contributors that have more than 15 years of experience and use tabs have higher median salary than people who use spaces. Additionally, if you have less than 15 years of professional experience and use tabs, contributing to open source is not related to higher salaries. But if you use spaces, you're better paid if you also contribute to open source than if you don't.
Having already reminded us that correlation does not imply causation, Gabasova next looked for another variable that differentiated higher paid devs from the rest was surprised to discover that it was version control, with Git being associated with higher pay compared to Team Foundation Server:
Looking at both indentation preference and choice of version control it is Git use that comes out as the factor that correlates with high salary:
Commenting on this Gabasova writes:
Interestingly, version control system breaks the pattern of higher salaries being always associated with space users. Companies using Git have mostly higher salaries regardless of indentation method, at least for developers with up to 10 years of experience! People using tabs with Git have larger salary than people using spaces with TFS, across all experience levels. Within the Git using group, people using spaces still have higher salaries than people using tabs. But within the TFS group, the pattern is not that clear: people using spaces with TFS have the lowest salaries for some of the groups.
The conclusion she comes to is:
To sum it up, the combination of open source contributions and version control system usage accounts for at least some of the difference in salaries between tab and spaces users. This doesn't mean that you should start using Git and contribute to open source to get paid more (although it would be great if you did that anyway!).
I believe these two factors together point more towards different environments and different types of companies, how traditional they are and how they use modern technologies. More traditional old-school companies that don't use Git and open source code seem to have lower salaries in general. The type of environment is hard to measure directly in a survey and both of these factors only point in this direction.
The idea that a difference between two very different working environments accounts for differences in salary does seem convincing. But at the end of the day you are likely to have entrenched views about indentation method. The main issues should surely be consistency - and spaces do seem to be superior in this respect.
or email your comment to: email@example.com
|Last Updated ( Monday, 17 July 2017 )|