A programmer friend recently revealed that his company has a strict no-tabs policy, and that they are forced to use space indentation… at no fewer than eight spaces. This makes me sad.

The spaces vs tabs debate is an age-old one, with proponents on both sides fighting the cause as avidly as in the editor wars, browser wars, language wars and probably a bunch of others.

The spaces people argue that indentation should be applied by repeatedly pressing the spacebar key a certain, consistent number of times:

The tabs people, on the other hand, believe in pressing the tab key just once. This makes the next character align vertically to the next tab stop:

Personally I like to see code with its indents at 4-character widths, and when code has been indented nice and atomically with one tab per indent level, I can configure my editor to make that happen. When I make changes to the code and save it, the tabs are still there in place so the next reader could view it with tabs at 8-character widths.

With spaces, if I wanted to see a different amount of indentation I'd have to go through every line and add/remove spaces as required, and then that change would affect all other viewers of the code. It would also involve pointless updates to a version control repository.

Which do you use? If tabs, how far apart are your tab stops when you code? (For indentation, that is, which is the only time you should use them.) If spaces, can you explain the benefit to me? Please?

Update: Setting your client to insert multiple space characters when you hit the 'tab' key does not count. It's just a keyboard shortcut; you're still inserting space characters into your code that render a fixed, hard-coded amount of spacing.