Live data from Hacker News

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

stackoverflow.blog

311–320 of 690 posts

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

#312
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.

Not sure what you're talking about here. In Python, as long as the indentation is consistent you could (e.g.) use 2-space indentation to make a code block. It's considered bad practice, and most linters will complain about it since 4-space indentation is the "golden rule."

If you're talking about the Python interpreter's interpretation of the tab character in indentation, that's different[1]. In any case, old code that has 8-space indentation using spaces rather than tabs is still good. The only issue would be old code that mixed tabs and spaces for indentation, which might not match up anymore to make correct code blocks. But, in general, it's just a bad idea to mix tabs and spaces for indentation.

[1] To the uninitiated, the Python interpreter treats a tab as X number of spaces when parsing the source code. This means that technically you could mix a block's indentation between tabs and a corresponding number of spaces. For example, if X = 4, then this code block would work:

  def function():
  something()
      something_else()

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

#314

I see a few arguments here which suggest people think tab-users might care less about their code and/or their fellow coder. As someone who slightly prefers tabs and abhors mixing of tabs/spaces, I find this frustrating. I generally prefer tabs because I feel that they're more egalitarian: I like 4-space indentation, but don't want to force that on everyone encountering my code. Similarly, I find 2-space indentation v…

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 tidy, 2-space-indented file.

If you configure your editor to drop spaces when you hit 'tab', then the file is guaranteed to look the same for everyone, and stops being context-dependent-- a bad thing for plain text, IMO.

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

#315

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…

> People who use spaces want to line up their '=' signs How does that prevent the use of tabs? You can use tabs to indent, and spaces for your = signs.

Mixing tabs and spaces is a nightmare, unless it is your personal non-open project. If a project is open or shared with anyone you need a simple rule to follow. There shouldn't be another leaf in the decision tree for when to use tabs or spaces. We have enough decisions to make the way it is.

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

#316
post #310

Earlier quoted context omitted.

> Don't think you make hiring decisions based on tabs vs spaces? I actually ask candidates "spaces or tabs?" in every single interview. I don't really care what the response is in regard to the holy war, and it doesn't mean anything on its own, but having SOME thought out response can be a GREAT indicator of how well versed someone is in general. e.g. I'm going to think way more highly of someone that says "tabs, bec…

Does spending time considering the implications of spaces vs tabs really indicate competence? To me being over-obsessed with minor details might be either negative or at most neutral value. There are thousands of interesting programming subjects to initiate a conversation to evaluate competency. At most it's a matter of what tools you use as well as accepted standards in the individual programming language's communit…

> Does spending time considering the implications of spaces vs tabs really indicate competence?

No, it signifies that you have spent enough time programming in a wide variety of platforms and with enough other peers to run in to the issue and understand that it exists.

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

#317

I only use tabs in my Makefiles.

Makefiles are the reason I use tabs everywhere. No need to switch mentally - or switch editor settings. But I'm rather poor ... maybe Makefile are the reasons for that? I need that correlation betweenn Makefile writers and income!

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

#318
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.…

You think you are doing others a favor by using tabs, but in fact you are creating a hassle instead. When I open your tabbed code the first thing I have to do is run it through some script that replaces all tabs with spaces, so that the files will be formatted the same way as the rest of the code base.

Some script? You mean the built in Unix utility 'expand'?

Supposing I submitted code indented with spaces, but the wrong number. Would making the formatting match be easier, or harder?

Maybe you should just use tabs in your codebase.

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

#319
post #276

Well, of course. Only companies with fuck-you money can afford the extra bytes spaces take up versus tabs, so it follows logically that they'd pay their developers more.

While your comment is obviously meant as a joke, it somehow rings true from my anecdotal experience. I'd also like to see an analysis of space-vs-tabs as it relates to operating systems. Again, from anecdotal experience, it seems spaces are more common for folks with *nix background who tend to work in product-oriented companies (i.e. where code is an asset) and tabs are more common with windows folks, who tend to wo…

I'd like to add my own anecdote: Windows development primarily happens on one vendor's IDE - Microsoft Visual Studio, and where MS leads, Windows-based developer follow.

Case in point - I use the default Visual Studio settings which are spaces, BUT they weren't always. I remember as recently as 2008 tabs were the default.

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

#320
post #307
post #207

Earlier quoted context omitted.

> when another developer looks at the code, their IDE will render the tabs as whatever its set up for, 2 spaces, 4 spaces, etc. This is an argument I hear often from tab proponents. What it misses out is the downside: my IDE has a certain arrangement on my screen, and I'll either have to invoke horizontal scrolling or I'll have a bunch of wasted space if you are using different size tabs from me. This is far from fle…

> I'll either have to invoke horizontal scrolling or I'll have a bunch of wasted space if you are using different size tabs from me. So change your tab size? That's true if you have a different sized monitor, no matter what the tab size. That's... kind of the point of using tabs. >I've come to the conclusion that the only sensible tab width is 8, since that works everywhere including in tools where it isn't practical…

> Also, what do you mean "works"? The world doesn't

explode if

> you view a file with a different tab size than it

was created

> with. Again, kind of the point...

It does, as I demonstrate in my quote of you above. Try reading source code like that.

The only sensible way of reading source code is by viewing it with at the same overall window width in which the author wrote it. Viewing at a different tab size destroys this.

> Pass -x[size] to less or put it in the LESS environment variable to make it default. You can also type it in while less is running.

Except that I need to figure out the most appropriate tab size to use on a per-file-author basis if "variable tabs" were used, so this doesn't work because I get the problem as described above.

Post reply on HN