Why Tabs Are Better Than Spaces
Published
Right, now that I actually have your attention. The more appropriate title of this post would be:
Free (1) Month Gift Subscriptions to the Pragmatic Engineer Newsletter
Since I picked up the Black Friday / Cyber Monday discount on the Pragmatic Engineer newsletter I have a couple 1-month gift subscriptions available. Just /contact me — all I need is your email.
If you’re truly curious my “perfect world” take on tabs versus spaces is:
- Tabs for indentation.
- Spaces for alignment.
What do I mean by that? Tabs for block indentation and spaces for aligning based on character widths. Consider:
Tabs for indentation, spaces for alignment.
However, I’ve found that only really works out if it’s a solo project where it’s just me. Most people don’t have their text editors configured to show invisible characters like tabs, spaces, newlines, line breaks, etc. So, in practice I’ve been on the spaces side for years.
But, I was wrong. Objectively, tabs are better:
- There’s probably already tooling configured e.g. EditorConfig.
- Tabs can be configured to display at a certain length.
- Accessibility: see above and also braille displays.
I love hearing from readers so please feel free to reach out.
Reply via email • Subscribe via RSS or email
Last modified #programming #opinion