9 ms·
Developers Who Use Spaces Make More Money Than Those Who Use Tabs (2017)
- sideshowmel 7y ago:set expandtab
- deleted 7y ago[deleted]
- ChrisSD 7y agoMore people drown after having eaten an ice cream.
- deleted 7y ago[deleted]
- travbrack 7y ago* based on one survey of self-reported data
- wwweston 7y agoIn case anyone wonders why someone might answer "both" (other than an entirely undisciplined approach): Tabs for line indentation, spaces for every other kind of alignment is one philosophy. It's the one that seems to hit the sweet spot for most of the issues that I care about (cross-editor consistent yet flexible management of line indentation depth as controlled by hits of the tab key + tabstop setting). But if you're running the project and decide spaces are The One True Way™, I'll figure out a way to get the editor to do it for me and ask you for a raise for the trouble (and, of course, market standards). ;)
- umvi 7y ago> I'll figure out a way to get the editor to do it for me and ask you for a raise for the trouble You don't have to "figure out" anything. It's the default of every IDE I've ever used. I press tab, VSCode inserts 4 spaces. I press shift+tab, it deletes 4 spaces. Nobody actually presses spacebar 4 times to indent unless they are forced to use vim on some remote machine.
- rhoyerboat 7y ago> Nobody actually presses spacebar 4 times to indent unless they are forced to use vim on some remote machine. Totally, hazard pay factor. ;) ..but I do it because of habits learned in python shell and also because of that cowboy character on the Simpsons cartoon that called himself OCD about the number 4 and then counted 1,2,3,4 tapping his foot and shooting his gun into the air.
- xapata 7y agoThat was only necessary in Python shell briefly because of a bug. The bug was supposed to be a release blocker, but accidentally got marked incorrectly. It's fixed now, and has been for some time.
- styglian 7y ago> Nobody actually presses spacebar 4 times to indent unless they are forced to use vim on some remote machine. Even then, you can just use >> and << in vim; as long as it's set up correctly it'll insert spaces. Works with whole sections in visual mode too ("v, down, down, down, >" will indent four lines).
- leerob 7y agoFor all my JavaScript developers - just gonna leave this here. https://standardjs.com/ https://standardjs.com/
- rhacker 7y agoWouldn't this make sense? https://medium.com/@hoffa/400-000-github-repositories-1-billion-files-14-terabytes-of-code-spaces-or-tabs-7cfe0b5dd7fd#.j6ki2b7og https://medium.com/@hoffa/400-000-github-repositories-1-bill... So the number of people that prefer spaces far outweighs the tabbers. Now, take the pool of people that use spaces and tabs and let them compete for a 100k job. 9 times out of 10 even if randomly hired it will be a space person. Also, as a by the way, on the medium post. The reason Java has so much tabs is specifically due to the default Eclipse formatting that prefers a mix Tab/Space approach. Which is absolutely horrifying in my personal opinion. I don't have any numbers but Eclipse probably holds 80%, followed by Netbeans and/or IntelliJ. (both of which default to spaces)
- NobodyNada 7y ago> Take the pool of people that use spaces and tabs and let them compete for a 100k job. 9 times out of 10 even if randomly hired it will be a space person. But you'll get the same result when they compete for a job that pays poorly. If all other factors were equal, the distribution of developers who prefer tabs should match that of developers who prefer spaces. By your argument, people named Steve would make less money, because they're outnumbered by people not named Steve.
- hencq 7y agoThis could still be true though. There are more likely to be outliers in the large group than in the small group. However, there is a lower bound on the number (nobody makes below $0), but no upper bound. So the distribution is likely to be skewed. So yes, people named Steve would make less money (though this argument might not work as well for people named Jeff, Warren or Bill I guess).
- Grustaf 7y agoI am not sure exactly what your argument is, but it doesn’t sound correct. The differences will be larger in the smaller group, but the expected value for the average pay in a group is independent of its size. That’s why you can use a sample to find out something about a population.
- deleted 7y ago[deleted]
- qzygr 7y agoI like tabs because it allows developers to configure their editors with whatever width they desire.
- inanutshellus 7y agotabs don't work when you visually align code. e.g. some.method(param, param2, param3) The above doesn't work if the creator of the code uses a different tab width than I do. If you want it to, you need to use an IDE that automatically recognizes the difference between indentation and alignment... which is frankly too much trust in others if you care about it. If a default install of an IDE (including vIM) will screw up your code.... you might consider rethinking your strategy. :-)
- deleted 7y ago[deleted]
- qzygr 7y agosome.method(param, param2, param3)
- deleted 7y ago[deleted]
- insertnickname 7y agoThat code would be misaligned anyway when someone changes the name of `some` or `method`. You should format it like this (regardless of whether you use tabs or spaces): some.method( param, param2, param3 )
- DHPersonal 7y agoThat would be how I would do it, because generally the coding I do is simple enough that I can trust Visual Studio Code to "Beautify" my finished work and insert all the tabs it needs to align things.
- dvt 7y agoI prefer spaces purely out of consistency reasons. Some systems say a tab is 8 spaces, others say it's 4. Some editors can set a tab to any customizable N spaces. But a space is always a space so your code will look like you intended (or should I say indented) it no matter who's looking at it.
- tedmiston 7y agoWhile I agree with you personally, I could see the counterargument of: A tab is always a tab, and I can tweak my IDE to render a tab as however many spaces I like (2, 4, 8, etc) without changing the code.
- dvt 7y agoIn a lot of cases though, you can't change what a tab is (consider looking at code on GitHub).
- tedmiston 7y agoThis is a good point. Maybe at some distant point in the future we will softly decouple formatting from code by delegating it all to finely tuned autoformatters, or totally decouple it by storing code in a slightly more abstract form such that whitespace rendering becomes largely a presentation preference.
- ChrisSD 7y agoYou can on Github but it requires using `?ts=4` in the url or committing an editorconfig file. Perhaps there are extensions that do it automatically.
- qes 7y ago> I can tweak my IDE to render a tab as however many spaces I like Sure, IDE's are easy (though many people use multiple IDE's and/or editors across multiple machines). I've also got a couple diff tools, a few VCS's, also the online parts of VCS like web-based pull request review UI's. Tabs also tend not to play as nice with vertically aligned elements, if you prefer that for things like say the '.' on multi-line chained method calls, or longer function parameter lists.
- natvert 7y agoOk, but 2 or 4 spaces?!
- Dylan16807 7y ago3 looks pretty nice in a lot of code...
- graywh 7y agoheretic
- TimTheTinker 7y agoPlease don't do that. Just... please... don't. I will have trouble controlling my frustration if I ever have to work on a codebase built with 3 spaces per indentation.
- Dylan16807 7y agoThere's zero logical reason to use a power of two, though.
- CasualSuperman 7y agoIf you use tabs, you can customize how it looks. ;)
- hathawsh 7y agoYes. :-) The right answer depends on the project. I really appreciate it when projects have .editorconfig files so that indentation just works. https://editorconfig.org/ https://editorconfig.org/
- Sohcahtoa82 7y ago4. Also, max line width should be 120 characters. 80 is too limiting if you're using sensible variable names like you should.
- Bootwizard 7y agoSo where does using the "tabs to spaces" tool lie here? I technically press the tab button but my edit inserts 4 spaces.
- beardedProgmr 7y agoThose salaries are painfully low. I started at 75k. Who's making less than 50k and in such great numbers? This must be non US jobs? I question this data.
- tedmiston 7y agoThe data is global, hence the heavily skewed median compared to US alone. Check out the 6 bar charts that group by country.
- elboru 7y ago99% of the planet would disagree with you: http://www.globalrichlist.com/ http://www.globalrichlist.com/
- beardedProgmr 7y agoWe are talking about software engineers. I'm not talking about top company pay either. I don't think I've ever gotten an offer for 50k
- deleted 7y ago[deleted]
- erichurkman 7y agoOr give up the fight over formatting in general and adopt a tool like [0] Black, which has no rules or options to configure and only one correct style. _You can have any any style you want, as long as it's black._ [0] https://black.readthedocs.io/en/stable/ https://black.readthedocs.io/en/stable/
- Shorel 7y agoI was going to complain about it, but I like all the formatting decisions made by black.
- rfer34f 7y agoThat is an old post (June 2017). I thought it was now accepted that people should use tabs, until I read the comments here. From a recent post, Nobody talks about the real reason to use tabs over spaces, https://news.ycombinator.com/item?id=20341354; https://news.ycombinator.com/item?id=20341354; if you're visually impared, using spaces make for poor accessibility. Don't be a dick, use tabs!
- commandlinefan 7y agoProbably because they can read their code.
- deleted 7y ago[deleted]
- amapletree 7y agoIANADS, but this one is actually pretty easy to explain. Using tabs is stupid. Therefore, people who prefer using tabs tend to be stupider than people who prefer using spaces. Generally speaking, stupider people make less money than less stupider people.
- deleted 7y ago[deleted]
- dschnurr 7y agoHopefully nobody uses an article like this to really inform their decision on which to use. Last month there was a reddit discussion that outlined some really compelling accessibility-related reasons to use tabs, worth a read: https://www.reddit.com/r/javascript/comments/c8drjo/nobody_talks_about_the_real_reason_to_use_tabs/ https://www.reddit.com/r/javascript/comments/c8drjo/nobody_t...
- peterlk 7y agoThis 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.
- ssully 7y agoI really think the split is almost purely a generational thing. If your first exposure to computers/coding was using a terminal, I think you will end up leaning towards spaces. If you grew up in the post GUI world on Windows or Mac, I think you end up leaning towards spaces.
- godelski 7y agoIf that's true it could explain the pay gap. By replacing pay gap with experience gap. Which makes sense that there would be a difference in pay.
- waterhouse 7y agoShould one of those "towards spaces" have been "towards tabs"?
- ldiracdelta 7y agoPurely a guess, but I think that spaces vs tabs is a proxy indicator of some psychological difference. Perhaps it is conscientiousness. On some editors, you have to go out of your way to change tabs to spaces. If you're very picky about how your code looks and want it to always look the same in every editor and to everyone, then maybe you use spaces. Personally, I do ascii diagrams and even arrows inside of comments to point to different variables and make comments on active code. I am very very picky about how my code looks. I know code aesthetics isn't a be all end all, but maybe it could be some psychological tendency like this. Also, I'm not a paragon of big bucks or awesome, revolutionary code. Over time, perhaps conscientiousness or fastidiousness keeps you employed or people give you more responsibility and money.
- buboard 7y agoThats racist It's probably related to the editor choices one makes? As a tabs-only person, i am probably a little more autistic, a little less social (spaces are easier to share with others), a little less open to new technologies.
- draw_down 7y agoCome on.
- inanutshellus 7y agoThis has come up before. My theory is this: Tabs are great if you work by yourself. If you work with others, you need more complicated rules to be followed like "tabs for indentation, spaces for alignment." So... My theory is that coders using spaces have worked in more places and/or larger places, which tend to end up paying more.
- larrydag 7y agoThis is one of those correlation != causation articles. Probably something symptomatic as you describe.
- B-Con 7y agoI suspect it could be large, well-paying companies with prescriptive style guides skewing the results. eg, Google standardized on spaces for all their languages I've interacted with, maybe some others did too.
- RussianCow 7y ago> Tabs are great if you work by yourself. If you work with others, you need more complicated rules to be followed like "tabs for indentation, spaces for alignment." Except you don't, because you could just never align code, which completely eliminates the problem. I find that aligning code is way more trouble than it's worth.
- penteract 7y agoAccording to the blog post, the effect remains when company size is taken into account.
- spacehunt 7y agoIf I'm reading the chart correctly, it seems that Go developers who use spaces rather than tabs actually earn more? That's quite surprising.
- nostrademons 7y agoIt is. I wonder if it's an artifact of the other languages used at the organization, i.e. Go developers who use spaces are likely to be working on utilities or support code for a product that's primarily written in C or C++ (and probably been generating revenue for a while), while Go developers who use spaces are more likely to be working in green-field pure Go codebases that are newer with less of an established market.
- deleted 7y ago[deleted]
- jaequery 7y agoThis is why the world will never make peace. If we can’t even agree on something silly as tabs vs spaces.
- TimTheTinker 7y agoI don't think it's silly. I strongly dislike the ergonomics of contributing to a codebase that uses tabs.
- jaequery 7y agoThose who prefer tabs have clearly not experienced the nightmare of collaborating with devs who were using spaces.
- jaequery 7y agoI guess the same can be said for working with devs who Lint and those that dont
- adchari 7y agoI would bet this is due to some hidden variable. Maybe older or more experienced developers have a tendency to use spaces, so their compensation reflects age/level/experience, not their choice of indentation?
- scythe 7y agoTabs are adjustable, so more likely in larger teams. But devs on smaller teams probably make more as individuals. That’s my guess.
- adchari 7y agoNever mind, reading the article sees him cover at least the experience, language, and location of the developers, and there is still a significant difference. Maybe the team aspect made a difference, or devs worked at companies with strict style guidelines, which happened to be companies who pay well, or because that company is on their resume, they make more later on?
- benttoothpaste 7y agoI've always suspected that "go fmt" is a tool of income suppression...
- writepub 7y agoWhich camp does that put me in - I use the tab key for code indentation, but my editor is configured to replace tabs with 4 spaces
- crtlaltdel 7y agoi am always amazed at how much time people sink into these discussions :D as if commonly formatted textfiles was the biggest concern people have in their day-to-day ;)
- dep_b 7y agoAnd what about developers that add spaces by using the TAB-key?
- Sohcahtoa82 7y agoYou mean ALL of them? Question for all of you tabs people...do you guys think that spacers are hitting the space bar 2/4/8/X times?
- for_xyz 7y agoYes https://www.youtube.com/watch?v=SsoOG6ZeyUI https://www.youtube.com/watch?v=SsoOG6ZeyUI
- Sohcahtoa82 7y agoYeah I watch that show (I have a Hooli t-shirt!) and have seen that scene, and honestly that's when I first started posing my original question.
- vbtemp 7y agoIt's just cause people using tabs are not using properly configured IDEs or text editors, which reflects a lack of experience or adaptability, which reflects the lower salary. Edit: It's also kind of funny how people in this thread are making it seem like there's some kind of controversy. There isn't: the question was settled a long time ago.
- Grustaf 7y agoCan confirm
- robocat 7y agoFrom the given data it appears that people that use stackoverflow are being paid really really low wages. Maybe people who answer online surveys are poorly paid? My personal graphologist said that although tabbers earn more, they tend to be more focused on their work and less altruistic, so they answer less surveys. Sampling bias is difficult to avoid in the best designed research.
- stephc_int13 7y agoAm I the only one who doesn't give a fuck? Is it really a subject? And I'm not saying that code aesthetics doesn't matter, I tend to obsess over good typography and alignment, but I use both tabs and spaces, switching depending on the code-base/context, without even thinking about it.
- kpU8efre7r 7y agoWho gives a fuck about an Oxford comma?
- crazygringo 7y agoI think the biggest and most obvious control is missing here -- the company they work for. Much more likely is that companies that pay more, for whatever reason, insist on spaces rather than tabs as a required coding style. A quick Google search reveals spaces are used rather than tabs by Google, Twitter, Mozilla, Facebook, Microsoft, Apple... so that already seems fairly suggestive as the cause to me.
- TimTheTinker 7y agoI suspect part of the reason is that using spaces makes it easier to collaborate with many other developers on a single codebase. There's no worrying "How will this look to others who override the default tab width?", "How to make this line up most consistently for everyone?", "Will it cause issues for me if I override the default tab width on this codebase?", etc.
- maxk42 7y agoOr the language they're working in. Python devs use spaces, go devs use tabs. But I don't think the average Python dev makes more than the average go dev.
- sdinsn 7y ago> Python devs use spaces Speak for yourself- I use tabs with every language
- LordDragonfang 7y agoIf you scroll down a little bit, they control for language and spaces are still higher across the board.
- notacoward 7y agoYep, that's pretty much. It has nothing to do with which is better. Nothing whatsoever. It's just that a handful of companies that hire a ton of programmers and pay them a ton of money happen to share the same bias, and even that's probably because of copying each other. Even if you controlled for current company, alumni of those few have probably carried the gospel even further, again no matter if it's right or wrong. It's like observing that people who dress like Wall Street brokers make more money than people who don't, without considering what else it might mean that someone works (or had worked) on Wall Street.
- Koshkin 7y ago4x or 8x ?
- jshprentz 7y agoBack when communications and printing devices were much slower, we often chose tab stops to reduce the number of characters sent. I have used this algorithm, but I doubt it impacted my career earnings. James L. Peterson, James R. Bitner, and John H. Howard, ``On the Selection of Optimal Tab Settings'', Communications of the ACM, Volume 21, Number 12, (December 1978), pages 1004-1007. http://jklp.org/profession/papers/tab/paper.html http://jklp.org/profession/papers/tab/paper.html
- tcmb 7y ago(2017)
- TimTheTinker 7y agoI strongly favor spaces, because using tabs adds one more thing to worry about when writing code to be read by others. I suspect a lot of folks who work on large, multi-dev projects feel the same way. We prefer to lay out our code and indentations with the expectation of consistency for others. Spaces allow us to not worry "Will this be readable by colleagues who prefer 2-wide tabs vs. 4-wide tabs?" We just adopt a convention (2 or 4 spaces) for each codebase and run with it. Similarly, when others have used spaces, it's one less thing to worry about when starting work on a new codebase. There's no evaluating "will this codebase look better with 2-wide or 4-wide tabs?" or "Can I override the default tab width with my preference, or will that make this codebase less readable?"
- thfuran 7y ago> Spaces allow us to not worry "Will this be readable by colleagues who prefer 2-wide tabs vs. 4-wide tabs?" We just adopt a convention (2 or 4 spaces) for each codebase and run with it. I don't get it. It allows you to not worry about it by letting you just say "no, it won't be readable by you because we arbitrarily decided to make your life difficult". Tabs are the one that let you not worry about whether people who prefer a different tab width will find the code readable because they can configure a different tab width.
- TimTheTinker 7y agoThat may be true for codebases that always use a single tab for each indentation level -- I get that. But to stay readable regardless of tab width, it requires a coding style that keeps indentation strictly consistent with syntactic context (not an issue in Python, since indentation is syntactically significant already). It also limits what developers can do to align things in JavaScript, Lisp, Ruby, C#, etc. -- especially when using complex call chains/lambdas, large literal data objects, s-expressions, long parallel repetitions blocks of code, etc. In those cases, using spaces is a huge benefit, because it provides a way to scoot things left or right to make them more readable. With tabs, you can't do that unless you mix tabs and spaces -- which is not cool at all.
- 7y ago
- robbrown451 7y agoIt seems to me that the benefits of tabs tend to are reduced as storage becomes cheaper, as text editors get more powerful, and as various other tools becomes smarter. So people sticking with tabs are more typically "old-school" and stubborn in all their approaches. And that can explain the pay difference.
- mjevans 7y agoTabs clearly indicate a specific level of indent. Spaces may or may not be rendered to a specific width in different editors, and in fixed width editors are equivalent to 'pixel perfect' rendering; the difference between a dead tree rendering that is static and an electronic metadata included document.
- m463 7y agoThis can be summed up "developers with experience with others use spaces" Tabs do not interact well with teams. Spaces are a source of consistency for teams. Basically, spaces have the same indentation for everyone sharing code while tabs do not. To set up spaces only in your editor requires a mindful effort. https://www.jwz.org/doc/tabs-vs-spaces.html https://www.jwz.org/doc/tabs-vs-spaces.html
- awkward 7y agoI wonder if this is related to acculturation. I would guess that people who are trained as computer scientists or work in tech are exposed to arguments over whitespace, and more self taught people are not. Not to say that spaces are a more sophisticated choice, but that the higher paying sectors are more polarized.
- maxk42 7y agoMy personal preference is tabs and the reason I never hear given is that I simply don't want to press a button two or four times when I can press it once. When I type a single tab: bam! code indented. When I type backspace, the indentation is removed. It's easy. When I'm using spaces -- even in an editor that expands tabs to spaces -- I have to press backspace four times to de-indent code. I end up de-indenting a lot of code because a pet peeve of mine is unnecessary conditionals. For example if you'll pardon the formatting: if(cond) { flag = true; } else { flag = false; } can often be represented as just: flag = false; if(cond) { flag = true; } and in languages that initialize variables, often the first line can be omitted as well. I just feel like I'm stuck in molasses, having to go through several extra steps whenever I'm writing code that compels the use of spaces over tabs. That said: It's a personal preference and I'll use spaces where appropriate. Most people's argument against tabs seems to have to do with vertically aligning code. This is a shit argument, because tabs should be used for indentation only. If your indentation is the proper number of levels then spaces can be used for any remaining vertical alignment. Tabs should be used for indentation, not vertical alignment. Example: tabtabtabtabType myArray[] = { tabtabtabtabtab 123, 456, 789, 101112, tabtabtabtabtab131415, 161718, 192021, 222324 tabtabtabtab}; It's not difficult and problems only appear when some n00b tries using tabs between the numbers in the above example to line values up. If you do that you're going to have a bad time.
- bryanlarsen 7y ago"I have to press backspace four times to de-indent code" I used to only press backspace once to delete four spaces because I use a better editor. Now I press it zero times because I've integrated black, gofmt and prettier.js into my editor and it indents automatically.
- umvi 7y ago> When I type a single tab: bam! code indented. When I type backspace, the indentation is removed. It's easy. When I'm using spaces -- even in an editor that expands tabs to spaces -- I have to press backspace four times to de-indent code Newer editors like VSCode handle this correctly. Tab = add 4 spaces, delete = remove 4 spaces. But really, you should get in the habit of using tab to indent, and shift+tab to deindent (not delete). shift+tab has the added advantage of being able to deintent an entire highlighted block of code in virtually all editors. > can often be represented as just: Well, in this case you could just do `flag = cond` but I see your point > Most people's argument against tabs seems to have to do with vertically aligning code. This is a shit argument, because tabs should be used for indentation only. If your indentation is the proper number of levels then spaces can be used for any remaining vertical alignment. Well, a lot of people haven't configured their editors to visually see whitespace, and since it is invisible by default, it means a lot of code with mixed whitespace is committed which is a hard problem to solve. So you just configure your auto-formatter to convert everything to spaces so there is no ambiguity.
- lukev 7y agoAll the tab advocates in this thread are like "Tabs are great, all you have to do is..." That's why spaces are better. There's no "all you have to do." There's nothing. Just use spaces. Your code will look fine everywhere. Done. Separation of content and presentation is a fine principle for many things, but as long as we're coding using text files, we are already far removed from that world. May as well stay simple and embrace the literal characters.
- nemetroid 7y ago> Your code will look fine everywhere. ...or nowhere, depending on who is reading.
- nemetroid 7y agoI would be fine with using spaces if it weren't for all the spaces-users. More specifically, how so many projects seem to go for the shortest common denominator, often just two spaces. I mostly write C++, and agree strongly with the rationale given in the Linux coding style for using 8-char tabs - it promotes better design practices: > Now, some people will claim that having 8-character indentations makes the code move too far to the right, and makes it hard to read on a 80-character terminal screen. The answer to that is that if you need more than 3 levels of indentation, you're screwed anyway, and should fix your program. > In short, 8-char indents make things easier to read, and have the added benefit of warning you when you're nesting your functions too deep. Heed that warning.
- nihilarian 7y agoPeople who are paid per character would receive slightly more and people who are paid per hour would take a little longer to type the spaces therefore would likely be remunerated slightly better than those that type tabs. There, I've accounted for 0.001% of the difference in earnings.
- firemelt 7y agoI really don't understand the war behind this I always pressing tab button when I want to tabs(giving more than one space) things Does the war is about pressing tab button vs space button? Or is it about the underlying of it? Afaik when We press the tab button the editor is sending a space right? Then what's with the fuss?