I Joined The Tab Gang

2022-08-20 | CC BY-SA 4.0

If you've done a considerable amount of programming, you must have heard of the Space vs. Tab battle, and perhaps picked a side. In personal hobby projects, this is mostly a choice of aesthetics. Ever since 13 or something I had been using 4 spaces, but on 2022-08-12, I am announcing my departure from this style for the tab character. (With the notable exception of Python)

For too long have I been fooled by the Space Gang. Portable? Yes, but so are tabs. Configurable? Yes, but tabs more so. Compared to 4 spaces, tab has three advantages that won me over:

  1. 3 fewer bytes each indentation level;
  2. No need to worry about accidental 3- and 5-space indents;
  3. 3 fewer characters on a Braille display.

1 and 2 are good reasons, yes, but the third one really moved me the way a truck tows a car in the disabled spot. Per Wikipedia, a Braille display looks like this:

A refreshable Braille display

This one is 40 characters wide but 80-character models are sold. Screen space is precious. Imagine dragging your finger across the line of code, only to find the first 16 characters wasted on indentation using 4 levels of 4 spaces. It would be different if you used tabs. A tab is a single character, so 4 tabs would only use 4 braille cells, leaving the remaining 36 cells for code. (Note that, however, I do not know any visually disabled person to testify this claim.)

The lesson? When you find yourself weighing two options over an issue you think makes little difference to you, try considering how it affects people who live a different life from yours. Like how you design your "Accept/Decline call" UI on a mobile phone so that a senior person knows instantly what to do, instead of wondering if they should click, drag, or swipe. This kind of decision should not be made in a condescending manner. Instead, you and I should pay attention to the lives of different people: the technologically illiterate, the homeless, the disabled, and everyone you think deserves a better life than they have, and make informed decisions when you have the chance. Sometimes it's as simple as set noexpandtab.