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.

 

tabspapoll

 

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:

 

  • Years of programming experience
  • Contributing to open source
  • PHP

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.

saldiffos 

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.

tabspaos

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:

saldiffosindent

Gabasova comments:

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:

saldiffgittfs

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:

saldiffversion

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.

More Information

Do you prefer tabs or spaces (poll)

Tabs, spaces and your salary - how is it really?

evelinag/stackoverflow-survey-analysis on GitHub

Related Articles

Tabs versus Spaces? Not Just Contentious But Economic 

Developer Pay Satisfaction According To Stack Overflow

Tabs Or Spaces - One Billion Files Later An Answer

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

 

Banner


Looking Forward To NAO 7
03/11/2024

Introduced to the world in 2004 by its creator Bruno Maisonnier the kid-sized, autonomous humanoid robot NAO, turns 20 this year. At less than 2 ft tall, it is small in stature, but plays a big r [ ... ]



Data Wrangler Gets Copilot Integration
11/11/2024

Microsoft has announced that Copilot is being integrated into Data Wrangler. The move will give data scientists the ability to use natural language to clean and transform data, and to get help with fi [ ... ]


More News

espbook

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Monday, 17 July 2017 )