DEV Community

loading...

Discussion on: Who Killed The Tab?

Collapse
bytebodger profile image
Adam Nathaniel Davis Author

When I've been lucky enough to do green-fields work, I've lobbied the rest of the team for 3-space indents. And the funny thing is that I've never gotten any pushback on it. No one else ever seems to mind. Which is doubly-frustrating for me, because 2-space indents actually present a (minor) difficulty for me. And yet I'm typically looking at 2-space-indented code simply because someone decided years ago that it should be the standard for JS.

You make a really good point about the tab-size CSS feature. If you accept my contention that viewing code in browsers exacerbates the tab hatred, then it makes sense to point the finger at the lack of configurable tab sizes in HTML (in the past). I hadn't even thought of it to that level.

On an even-more-tangential note, it still baffles me that the default indentation for tabs in HTML is 8 spaces. I'm not sure where that came from. I can't think of any other tool I've ever opened where 8-space indents were the default way to display a TAB character.

Collapse
v6 profile image
🦄N B🛡

I always blame POSIX in in-person conversation, because nobody will bother to look it up.

Collapse
darkwiiplayer profile image
DarkWiiPlayer

Fun fact, you can do this:

github.com/DarkWiiPlayer/restia/bl...

vs.

github.com/DarkWiiPlayer/restia/bl...

(Note the ?ts=3 at the end)

This works with pretty much all GitHub links, and recently also works with gist.github.com links. It's annoying that the default isn't something more reasonable (maybe 4?), but you can change it quite easily.

Thread Thread
bytebodger profile image
Adam Nathaniel Davis Author

That's cool! I hadn't seen that little query string variable option before.

Collapse
merri profile image
Vesa Piittinen • Edited

One guy claimed that Sun Java source was written in 8 tabs and was not very readable if you tried to look at it in 4 tabs.

But this is also interesting about Linux kernel docs: simplystatistics.org/2018/07/27/wh...

Tabs are 8 characters, and thus indentations are also 8 characters. There are heretic movements that try to make indentations 4 (or even 2!) characters deep, and that is akin to trying to define the value of PI to be 3.

So can we blame Linus Torvalds? It would be nice to get some anger back from him.

But interesting in general that there actually were 8-space indents in the 90's.

I also wonder if the 8-space tabs could have come from spreadsheet editors of the old age. Weren't the cells 8 characters by default?

Thread Thread
bytebodger profile image
Adam Nathaniel Davis Author

Ooh, I like that link. Specifically, I like the idea of using longer tab lengths to highlight potential code smells. Despite my long experience, it was only about, ohh, 4-5 years ago when I really started aggressively attacking my own nested code blocks. Originally, I didn't see much problem with them. But I've now come over to the camp that deeperNesting === codeThatShouldProbablyBeRefactored.

As for the spreadsheet observation - yeah... I think that may be one of the original culprits. I know I've heard that before.