Indent with tabs

indent-with-tabs.exe
created (updated in this commit)
Tags:

Some days ago a heated discussion broke out in a tech group I’m in. It was the old debate of tabs vs. spaces. I thought this debate was over, but apparently I was wrong…

I will answer what I found to be the most common arguments within the next paragraphs.

For a short summary from a Rust user click here

It screws up the formatting

This is just a strawman. We are talking about indentation, not alignment. Take the following examples with a tabwidth of 2, 5, and 8. Why 5? to show that it works even with unconventiuonal values.

	ladder.up()
	      .up()
	      .down()
	      .showStep();
	ladder.up()
	      .up()
	      .down()
	      .showStep();
	ladder.up()
	      .up()
	      .down()
	      .showStep();

The code looks different than on my screen

What’s your point? Not everyone wants the code to look as it does on your screen. Therefore tabs. Everyone should choose whether they want the reduced eye movement of 2 spaces, or the clear structure of 8 spaces. It’s not like people choose their tabsize because they think it’s just awfully trendy. If you don’t care; leave it at what most editors consider the default nowadays: 4.

Aligning is hard to do

We are programmers. There are tools that do it for you. And even better: with these you can work in spaces and just create a git filter that formats all files according to agreed-upon standards.

And no, that is not inconsistent. The tabs-vs-spaces debate was always about personal preference for me. If you feel like using 1 space indents, I could not care less. What I care about is the code that is checked out by default. Play around with it as you want and just format it before committing.

Conclusion

Tabs are just superior when it comes to accessibility and therefore a better default. Do what you want on your monitor, but try to help the guys who are not as lucky as you are. Nobody is changing their tab-value just for the sake of it, imposing spaces for this reason is not only unreasonable, it may ultimately hinder development if a person with special needs is hired.

Further reading


Do you know better? Have a comment? Great! Let me know by sending an email to ~poldi1405/comments@lists.sr.ht


If you feel like it, you can donate.
Unless stated otherwise the texts of this website are released under CC-BY and code-snippets under the GPL.
© Moritz Poldrack