My opinion on Tabs vs Spaces

On this year Stack Overflow survey, this never ending war showed some love in favor of Tabs.

I was a big Spaces user until a few months ago.

I now use Tabs and I don't think I'll switch back anytime soon.


Like many devs, I've always been very thorough with my indentation style. I used to spend a lot of time indenting stuff.

I'm a consultant in a consulting firm, so I get my hands on other people's code all the time. Trust me, not everyone thinks that consistent indentation is important...

It became crystal clear to me shortly after I enabled the indent guide on my code editor. This truly reveals your coworkers indentation style.

#1 Spaces are for presentation

With spaces, it's easier to achieve something like:

To have done that for a long time myself, I find that this kind in indentation leads to wasted time.

#2 How many spaces?

Are you using 2, 3 or 4 spaces per level? I tried them all for several months/years. Each had their advantages not none was perfect. 4 was my favorite.

Using Spaces in a team makes inconsistency easier.

#3 Tabs indentation is easier for collaboration

1 tab = 1 level of indentation, regardless of your number of spaces preference.

Let the others decide the width of that indentation.

This is my typical indentation style now:

Whether you use Tabs or Spaces doesn't make you a better or worst developer. Lack of consistency does!

Hell, maybe I'll switch back to Spaces in a few years. Who knows.

Oh and watch this...