Live data from Hacker News

Developers who use spaces make more money than those who use tabs

stackoverflow.blog

411–420 of 690 posts

Re: Developers who use spaces make more money than those who use tabs

#411

Doesnt using spaces to indent code waste a lot of time? I mean sure if you're only indenting once, it takes a few extra key presses to make 1 tab worth of space bar clicks but if your code gets really deep, then you're talking about wasting a lot of time hitting the space bar key per indent PER line...each subsequent line of indented code doubles the amount of space bar clicks... Am i missing something here? this sou…

Most IDEs can map the tab key to insert a certain number of spaces.

Re: Developers who use spaces make more money than those who use tabs

#412
post #123

The reason I use tabs is pretty simple. It's faster to move around only using the keyboard. It's also faster if I'm changing code that requires reformatting. Finally, when another developer looks at the code, their IDE will render the tabs as whatever its set up for, 2 spaces, 4 spaces, etc. In other words, it adds flexibility. Brace yourself: I use two spaces after the end of sentences too. [1] I am quite the rebel.…

> Finally, when another developer looks at the code, their IDE will render the tabs as whatever its set up for, 2 spaces, 4 spaces, etc. In other words, it adds flexibility. This is exactly why I use tabs and the reason which appears to never get cited in the holy wars. People who use spaces want to line up their '=' signs, that's fine, but I don't believe it's my position to enforce the amount of whitespace another…

"""The fact that Python's rule used to be 8 spaces, then got changed to 4 thereby invalidating old code really showed me how shortsighted it is to use a set number of spaces in a whitespace sensitive language."""

When exactly did it use 8 spaces? I have been using Python since 1996 and I don't recall this 8-spaces thing. Almost all code I've seen uses 4 spaces.

In any case, it doesn't matter because, as another commenter pointed out, as long as your indentation is consistent, your code will work just fine, no matter how many spaces you use for indentation. Even if some code does use 8 spaces, it should work without problems. (Tabs as well, by the way... it's mixing tabs and spaces that is a problem.)

Re: Developers who use spaces make more money than those who use tabs

#413

Earlier quoted context omitted.

> Finally, when another developer looks at the code, their IDE will render the tabs as whatever its set up for, 2 spaces, 4 spaces, etc. In other words, it adds flexibility. This is exactly why I use tabs and the reason which appears to never get cited in the holy wars. People who use spaces want to line up their '=' signs, that's fine, but I don't believe it's my position to enforce the amount of whitespace another…

> This is exactly why I use tabs and the reason which appears to never get cited in the holy wars. I see this cited every time. Unfortunately, it's bogus in practice. Consider: print('some long thing', further, arguments) If this is an indented block, you'd have to indent the second line to the correct depth with tabs, then add exactly six spaces for alignment . You have to mix spaces and tabs, which is never good ne…

Yes, Emacs used to group spaces into tabs. I think most editors these days do the right thing.

This problem goes away if you indent parameters instead of aligning them:

    print(
        'some long thing',
        further, arguments)
In this case it takes an extra line, but it's often shorter.[1]

[1] https://github.com/pennersr/django-allauth/blob/a44134688f5b...

Re: Developers who use spaces make more money than those who use tabs

#414
post #100

Earlier quoted context omitted.

It's pretty much an unwritten rule that a sarcastic joke on the internet with sufficient exposure will get a response by someone who didn't get it. Using /s really kills the fun (and whole point) of using sarcasm so it's a trade off to accept these comments will happen. I'm impartial to downvoting as to reply literally doesn't usually add to the conversation, which is generally the point of downvoting. Losing karma s…

Known as Poe's Law [1] [1] https://en.wikipedia.org/wiki/Poe%27s_law

I will don't understand why it's called Poe's Law if he said it in 2005. This phenomenon was well documented on Usenet by the early nineties.

Re: Developers who use spaces make more money than those who use tabs

#415
post #314

Earlier quoted context omitted.

Using tabs has the opposite of your intended effect: If there is any text which is vertically aligned beyond the first indent, then this alignment will break for anyone who doesn't have your tab width preference. They're then forced to change their editor settings to view your file in a non-broken way. I get way more pissed about someone else "forcing their preferences on me" when this happens than when I run into a…

Your issue is why you see people say "tabs for indentation, spaces for alignment." If you're trying to vertically align text, use tabs to keep it at the same indentation as the thing you're aligning to, and use spaces to adjust to vertical alignment. This will keep the vertical alignment regardless of the preferred width of the tab.

So for long lines to move an argument over to align with its predecessor on the previous line, like

    int f() {
        int someVariableName = myFunctionCall(expr(5),          // 
...you're saying line A is indented with tabs, and line B with spaces? Because that will misalign if your tab setting isn't the same.

Or are you saying that both A and B are indented with spaces? Then what about line C, which will misalign with A and B if your tab stop is a different width?

Or do we indent the entire body of f() with spaces, and then in that case you're basically using spaces everywhere, which the good idea that sparked this whole thing?

Re: Developers who use spaces make more money than those who use tabs

#416
I think people got it backwards. Brace yourselves. You don't earn less money because you use tabs, but instead you use spaces because you earn more money.

When I was working on my own small projects I was using tabs, or tabs combined with spaces, which yielded me not a lot of money.

Once I started working for a big corporation, the coding standards mandated by the company meant I could only use spaces, because people couldn't be trusted to use a nice space/tab combination.

Re: Developers who use spaces make more money than those who use tabs

#418

I don't understand how people can work with spaces. I had to reformat a colleague's query the other day and it was infuriating because all the tabs had somehow been converted to spaces. I had to edit it line by line instead of being able to easily shift entire blocks in either direction. Do Visual Studio and SSMS support the space equivalent of "Select X rows and tab them all at once"? I just tried now and all the co…

Most editors I've used will let you adjust indentation with the tab key in that situation. (The indentation still ends up as spaces, of course)

I do this on a daily basis to adjust my indentation in json/yaml files.

Re: Developers who use spaces make more money than those who use tabs

#420
As someone who switched preferences: i used to hate tabs

Then somebody asked me why. The answer was that Sun Solaris was a crappy operating system which would fail to boot if you used tabs in files like /etc/vfstab.

For some odd reason, I carried around a weird bias about tabs rather than regarding Sun as being shitty.

I worked somewhere where a bunch of folks preferred four spaces (because they came from Python), others two (because they came from JS). Use tabs, set your preferred tab size, boom, everyone gets along.

Post reply on HN