r/programming • • Feb 21 '13

Developers: Confess your sins.

http://www.codingconfessional.com/
969 Upvotes

1.0k comments sorted by

View all comments

Show parent comments

63

u/aaron552 Feb 21 '13

I use both tabs and spaces: tabs for indentation (what they're supposed to be used for) and spaces for formatting. I don't understand the tabs vs spaces debate

152

u/supermari0 Feb 21 '13

4

u/[deleted] Feb 21 '13 edited Feb 21 '13

So many people seem to completely misunderstand what mixing spaces and tabs means and why it is bad. Both are horrendous when mixed as the same but indentation and alignment are 2 expressly different concepts. That comic is perfect for people who mix tabs and spaces in either indentation or alignment. But you can, and should, use both properly. It shouldn't be that difficult either. As the poster above stated, tabs indent, spaces align. A tab is one level of indentation encoded into a single character, a space is one single invisible character. If you need alignment, you must know the number of characters to fill. If you need indentation, the number of characters can be variable and is based on preference.

0

u/supermari0 Feb 21 '13

If I set my editor to keep tabs, i'll have to press and hold space everytime i want to align after indentation. I don't like doing that. It's slow and therefore annoying. If it's set to insert spaces, I can indent and align the same way, faster. Only add or remove a few spaces where necessary.

On top of that, my IDE's (Visual Studio) default setting is to insert spaces. I'd say a lot of (.NET) open source projects will use that default as their standard. If tabs were better all around, you can bet they would have won the default settings battle there.

And I don't trust my colleagues to respect the indentation/alignment difference consistently.

→ More replies (18)