Monday, 2 April 2012

Spaces over tabs: A rationale

A wider range of people will read from a document than write to it.
A document formatted with spaces (instead of tabs) will look the same to all readers.
A document formatted with tabs will look different depending on the reader's tab settings.
In a corporate environment, it is easier to enforce uniformity in the settings of the text editors of the group of people who can write to the documents than of the (larger) group who can read from them.

If, like me, you use your spatial awareness to navigate source documents, and as a consequence, really like things to be vertically aligned (Guido, why do you hate us so?), viewing a tab-indented document with the wrong tab size set is very disconcerting.

So, for these reasons you should choose spaces over tabs, and set a uniform indent size. (4 seems to be the most commonly accepted convention)