Why I prefer spaces to tabs
Coding convention discussions are always fun. I just had one of them on the weekly Orchard meeting, where I’ve joked that spaces are objectively superior to tabs, by which I meant that there are objective arguments in favor of spaces that I find subjectively compelling..
The first argument for me is that a good programming font has to be a monospace font. Tabs are weird in that context because they are the only useful characters that are a different width than everything else. If, for whatever reason, you have to replace a space with another character, nothing else will move. If you replace a tab with anything else, the rest of the line will move. Additionally, if you change the tab width in your editor settings, the code will look different to you than to its author.
The second argument is that what you align is not always line beginnings. There are legitimate cases where the beginning of a line is aligned with some boundary inside the previous line. A typical example is a list of arguments for a method that is too long to fit on one line:
It is a legitimate preference to want the additional lines of parameters to align with the opening parenthesis. Tabs can’t do that consistently.
That’s my opinion. Pick your own. As always, what’s important is to set the rules for the project and stick to them…