For some software developers, the question of whether to use spaces or tabs for code indentation is a hotly contested one. There’s even an episode of the HBO comedy “Silicon Valley” in which a character destroys a budding romance by saying: “No way I’m going to be with someone who uses spaces over tabs.”
To those outside of the software industry, such a debate might seem trivial. But in programming, consistent formatting is all-important, especially since different editors and displays can present the same block of code in different ways. Code that’s a mess of tabs and spaces can lead to arguments and confusion among team members, slowing down projects.
“It doesn’t actually matter which coding styles you pick,” Jeff Atwood, co-founder of Stack Overflow, wrote in a notable blog posting way back in 2009. “What does matter is that you, and everyone else on your team, sticks with those conventions and uses them consistently.”
But according to some new data from Stack Overflow, what style you pick does have a notable impact on your salary. “Coders who use spaces for indentation make more money than ones who use tabs, even if they have the same amount of experience,” the company concluded in a blog post detailing the analysis.
Stack Overflow based that conclusion on the 12,426 respondents who answered a “tabs vs. spaces” question on its most recent developer survey, and who also provided salary data. Developers who relied on spaces had a median salary of $59,140, while those using tabs pulled down $43,750. Take a look at their graph:
That salary differential remained constant even when Stack Overflow’s analysts controlled for other factors: “It was difficult to make the effect shrink and basically impossible to make it disappear.”
As the blog posting points out, correlation is not necessarily causation. Nonetheless, the results—and Stack Overflow’s inability to eliminate confounding factors—is pretty fascinating. If you’re interested in exploring the mystery yourself, you can download the raw survey data (CSV).