Interesting how multiple people presumed that older devs prefer spaces, which seems like the opposite to me. Tabs are a thing of the past, people used to use them a lot, and now they are relatively rarely used.
Finally. Spaces are so annoying when it comes to aligning things without the help of an IDE. We use tabs at work and it’s awesome. It doesn’t matter what your tabs are set to (I use 3 spaces, fwiw) and everything is magically aligned. It requires a well-thought-out style guide to make it work I think.
This is one of the strongest cognitive dissonances that I have. And I have no idea why it exists. I know that rationally, tabs are really the better choice. Each user can choose how to display code in their editor.
But I just hate using them.
Maybe it was the 8 space default of vim (nano?) when I was sysadmining. Maybe it was that there was inertia, and tabs are always the thing that's causing problems. But I just can't get over it. I just don't like tabs.
After nearly 40 years' experience in programming, I offer that (as to computer source code) tabs should be outlawed. They are visually indistinguishable from spaces, they are handled differently in each editing environment, and they often result in difficult-to-detect bugs.
A space is a space, one character width (when fixed-pitch fonts are used). A tab, on the other hand, is whatever the editor thinks it is, and a given editor can be made to change how it represents a tab (by default eight character spaces).
The above problems become much more severe in languages and environments that honor whitespace -- examples Python and YAML.
There is no excuse for tabs in modern times. They were originally meant to regularize columns on a mechanical typewriter, then they were meant to save memory when memory was precious. Neither of these justifications (no pun intended) exists any longer.
I really don't get the point of tabs for visual layout in any kind of document be it plain text, source code, or a word processor document. They never seemed to work right for me.
I remember using the tab key to enter tabs back in school to make something like an informal, 2-or3-column table (or whatever I was actually doing). This would have been in Word. Things would line up pretty until I wanted to change some text. If I made it longer I would need to add another tab because the tab had shrunk to nothing. If I made it shorter the tab would jump into the previous section and no longer line up with the other lines.
As far as I can see, the same will happen with this source example if it were using tabs and a proportional font.
I came to this conclusion too after at least 20 years of using tabs; but mostly it was because of moving to white-space significant languages like Haskell, F#, etc. It was just too painful getting everything lined up with tabs and I needed the fidelity of spaces.
Previous to that with C/C++/C# the alignment usually took care of itself through the closing brace and IDE auto-formatting. So tabs was the natural unit of currency there.
I switched from tabs to spaces about a decade ago and I've never regretted it. I seldom find files written by crazy people who think 8 spaces is a viable tab width anymore so I can pretty much adjust to whatever nice 2 space or wasteful 4 space width the original file authors used.
Back in the 1970s, I chose tabs to save bytes in my text files. Today I feel like I can afford the extravagance.
Tabs only work in a perfect world where 100% of source files are always edited with tab aware editors and absolutely no one ever uses a space instead of tab.
I rather keep using spaces, like I have been doing since 1992, plus apparently it reflects on salary.
I prefer tabs, but I've Lemming-ed out a couple of times and tried spaces, and had to switch back because it was weird the way the editor treated them as a tab sometimes and a space other times.
Tabs are great, and I can only echo the article that I'm baffled why we aren't all using them.
Proper indentation (tabs for indentation, spaces for alignment) is still pretty hard to configure in most editors in my experience. Even in emacs I had to install an external package to get it to behave properly (and it still breaks from time to time).
Failing that I'd rather people just used spaces and no tabs. Using tabs for alignment just means it's going to look fucked up everywhere else. At least spaces are consistent.
The decision to use a character that is 8 chars wide for indentation of a highly nested code was not a brightest idea either.
I’d love to set up terminal tabstop size, textview tabstop size, github tabstop size, IM tabstop size, HN tabstop size, git gui plugin tabstop size, issue tracker tabstop size, tsv file format tabstop size if I used tabs. It makes you so productive.
Why strictly two spaces and no tabs? Ive found this to be a trend I just don't understand.
At my work we have ~30 front end developers and we have a strict tabs only policy, so everyone can use their IDE to choose their tab width depending on how they like it.
reply