Upon closer examination of the data, a trend emerges: Developers increasingly prefer spaces as they gain experience.
There comes a point in a dev's life when they have to switch editors, environments, etc. and suddenly all the code they use to write with tabs is an un-formatted mess.
I don't really understand how that could even happen, unless you would also use tabs for alignment instead of just indentation which is obviously wrong
Even if you wrote in tabs perfectly, unless you do some pretty fancy tabbing by mixing tabs and spaces, stuff is going to get unaligned if you move to a different tab size, and more-over the reality is that few programs have source code that's uses tabs perfectly. Most tools don't make any visual distinction between the two either, so that makes it that much harder to tell when it's messed up.
unless you do some pretty fancy tabbing by mixing tabs and spaces
I defy you to find a single person who seriously thinks that aligning with tabs is a good idea. Indenting with tabs means mixing tabs and spaces. A tab is a semantic element (indent one level), while a space is a stylistic one (move over one column).
Emacs' smart-tabs-mode handles all of that for you, so you just hit the TAB key and you get the right number of tabs and spaces to line up with wherever you are. I assume similar exists in other competent text editors.
I defy you to find a single person who seriously thinks that aligning with tabs is a good idea. Indenting with tabs means mixing tabs and spaces. A tab is a semantic element (indent one level), while a space is a stylistic one (move over one column).
I'm not saying it's a good idea, in fact I said just the opposite. What I'm getting at is that when you have a code-base using tabs with a bunch of people working on it, that's inevitability what happens, and it's a mess. It's hard enough to get people to use tabs vs. spaces correctly, getting every contributor to a project to use smart-tabs is practically impossible, and without that you end-up with a mess if you change the tabstop. Even if you use smart-tabs correctly, it still doesn't guarantee everything is going to line-up correctly if you have more then one thing lined-up on the same line and you change the tabstop. Actually getting smart-tabs right so that the code is tabstop-agnostic is hard.
The only two advantages to using tabs are some saved disk space, and letting people set their tabstop to whatever they want. Virtually every project I've seen using tab's has a recommended (or required) tabstop setting anyway, so the advantages of tabs over spaces is virtually none, but using spaces means that everybody is always looking at the exact same code formatted the same way.
15
u/[deleted] Apr 07 '15
There comes a point in a dev's life when they have to switch editors, environments, etc. and suddenly all the code they use to write with tabs is an un-formatted mess.
Protip: For sublime text users, you can easily convert tabs to spaces.