Back in January when Chris Lattner was on the ATP show, he had this to say about file indentation:

Some people argue that you should use three-space indent because then you certainly can’t have tabs in your file.

That introduces just how heated the debate about tabs versus spaces can become amongst developers. David Robinson gave a new twist to this debate when he published this at Stack Overflow today:

This is a bit of a “holy war” among software developers; one that’s been the subject of many debates and in-jokes. I use spaces, but I never thought it was particularly important. But today we’re releasing the raw data behind the Stack Overflow 2017 Developer Survey, and some analysis suggests this choice matters more than I expected.


Analyzing the data leads us to an interesting conclusion. Coders who use spaces for indentation make more money than ones who use tabs, even if they have the same amount of experience:

Like David says close to the end, correlation does not imply causation, but there is undeniably a correlation and that is bizarre when you think about it.

I can see why people are so strongly opinionated about this. As Jeff Atwood said in the aforelinked piece, “Only a moron would use tabs to format their code.” You truly are either a tabs or a spaces person, and clearly spaces is the winner, to the tune of $15,390 in salary. I loath the idea of storing hard tabs in version control. And to be honest, I’ve seen a lot of repos but I can honestly say I don’t recall ever seeing hard tabs used in the repos I work on. If there are people out there who like them, more power to them. But to me that would be a gut check. If code is version controlled in hard tabs, that’s indicative of a whole bunch of other issues, and you don’t want to work there. You don’t want a $15,390 pay cut just so you can use hard tabs. I’ll fight this one till the cows come home because it’s just plain wrong. You can use your tab key so long as you’re converting to soft tabs, and that’s it.

The problem is that when I hear people talking about tabs versus spaces, I often get the impression that for them, tabs versus spaces actually affects their day-to-day flow. That shouldn’t be happening. If your IDE requires you to manually type tabs or spaces for the purpose of indentation, you don’t have a very good IDE. I almost never have to do this in PHPStorm or Atom. Maybe you have to do this in a dinosaur IDE like BBEdit, but who uses BBEdit today? Further, using soft tabs resolves this issue completely. If you use the tab key with this setting, your IDE will convert your tab indents as two or four spaces. Lastly, a good IDE configuration will include a keyboard shortcut that you can run in a file to have it auto-indent to your lint specifications. With all of these abilities combined, tabs or spaces is something that you simply shouldn’t have to think about at all. If you’re indenting your files by hand, you’re doing it wrong. I’ve written more than 500 lines of code over the past two days and not once did I have to spend any time thinking about this. In a similar vein, Manton Reece recently admitted he doesn’t really know whether he’s using tabs versus spaces in his code. That’s how it’s supposed to be. End of discussion.

Back to work. ⌨️