My personal preference is tabs and the reason I never hear given is that I simply don't want to press a button two or four times when I can press it once. When I type a single tab: bam! code indented. When I type backspace, the indentation is removed. It's easy. When I'm using spaces -- even in an editor that expands tabs to spaces -- I have to press backspace four times to de-indent code. I end up de-indenting a lot of code because a pet peeve of mine is unnecessary conditionals. For example if you'll pardon the formatting:<p><pre><code> if(cond) {
flag = true;
} else {
flag = false;
}
</code></pre>
can often be represented as just:<p><pre><code> flag = false;
if(cond) {
flag = true;
}
</code></pre>
and in languages that initialize variables, often the first line can be omitted as well.<p>I just feel like I'm stuck in molasses, having to go through several extra steps whenever I'm writing code that compels the use of spaces over tabs. That said: It's a personal preference and I'll use spaces where appropriate.<p>Most people's argument against tabs seems to have to do with vertically aligning code. This is a shit argument, because tabs should be used for indentation only. If your indentation is the proper number of levels then spaces can be used for any remaining vertical alignment. Tabs should be used for indentation, not vertical alignment.<p>Example:<p><pre><code> tabtabtabtabType myArray[] = {
tabtabtabtabtab 123, 456, 789, 101112,
tabtabtabtabtab131415, 161718, 192021, 222324
tabtabtabtab};
</code></pre>
It's not difficult and problems only appear when some n00b tries using tabs between the numbers in the above example to line values up. If you do that you're going to have a bad time.