TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Developers Who Use Spaces Make More Money Than Those Who Use Tabs (2017)

118 pointsby aminabout 4 years ago

57 comments

srlabout 4 years ago
This is a <i>huge</i> effect. Implausibly huge? I&#x27;m reminded of Gelman et al&#x27;s piranhas: <a href="http:&#x2F;&#x2F;www.stat.columbia.edu&#x2F;~gelman&#x2F;research&#x2F;unpublished&#x2F;piranhas.pdf" rel="nofollow">http:&#x2F;&#x2F;www.stat.columbia.edu&#x2F;~gelman&#x2F;research&#x2F;unpublished&#x2F;pi...</a>. The &quot;folk theorem&quot; version is that you can&#x27;t have very many independent variables that all have large effects on salary. Saying that spaces vs tabs has a 10% effect is tantamount to saying that its one of the ten (or fewer) most important things about a developer.<p>So there <i>must</i> be a confounder. What could it be?<p>- Do the top schools all instruct students to always use spaces? This should have been partly taken care of when the author controlled for level of education though, right?<p>- Choice of editor? This seems like a weird one, but editor defaults are definitely linked to tabs vs spaces, and the survey didn&#x27;t even collect data on this.<p>- Starting language?<p>- Total number of languages used? Spaces are tolerable in more languages than tabs are. Of course, I&#x27;d expect &quot;both&quot; to beat &quot;spaces&quot; if this was the case.<p>None of these strikes me as particularly plausible, except maybe the last one. This result is kind of bothersome, because it&#x27;s big, obviously not a statistical fluke, and hard to understand.<p>EDIT: a past thread (<a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=20719010" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=20719010</a>) suggested that some higher paying companies mandate spaces. This also seems plausible.
评论 #27181560 未加载
评论 #27181188 未加载
评论 #27185295 未加载
评论 #27191465 未加载
kstenerudabout 4 years ago
I settled on spaces long ago for the following reasons:<p>- Tabs move the cursor to the next &quot;tab position&quot; but are invisible, which means that whenever someone hits tab in the middle of something (accidentally or otherwise for alignment), you end up with messed up looking text and alignment as soon as you view it with a different tab size.<p>- Trying to enforce &quot;tabs only for indentation&quot; rarely works without headaches because humans.<p>- Using monospaced characters everywhere means that you&#x27;ll never encounter positional issues ever.<p>I&#x27;ve worked in 2-space, 3-space, 4-space, and 8-space indentation houses and honestly, I don&#x27;t see the point of viewing indentation in your preferred size. It&#x27;s easy to adapt to the house rules, and the benefits outweigh the headaches.
评论 #27181535 未加载
评论 #27181585 未加载
评论 #27181772 未加载
评论 #27199119 未加载
评论 #27181676 未加载
mgabout 4 years ago
In theory, tabs for indention and spaces for alignment would be the best way to handle whitespace.<p>Unfortunately in practice, two factors are in the way:<p>1) Most developers are confused by this type of whitespace usage. Simply because it is the less popular practice. So when you have a codebase that uses tabs for indention, you get more broken commits from developers who stumble in keeping the system intact.<p>2) Out of the box, VIM has no easy way to colorize tabs. So when you look at your code, tabs and spaces look the same. You cannot say from just if the whitespace is ok or messed up. You can show all non printing chars with &quot;show list&quot; but that is not very nice on the eyes. Or you can configure &quot;show list&quot; to only highlight tabs but then you lose the ability to show all non printing chars.
评论 #27188639 未加载
评论 #27186190 未加载
评论 #27181608 未加载
评论 #27181568 未加载
评论 #27181349 未加载
strogonoffabout 4 years ago
My pet theory is that the preference for spaces comes from people who want their codebase to be equivalently readable in any editor right off the bat. With tabs, depending on editor configuration, the same codebase could look fine on one machine and be a mess on another.<p>Furthermore, I believe that with certain indentation styles (e.g., when arguments in a function call align with the opening paren) tabs require that one extra preliminary step of configuring one’s editor in order to <i>view</i> the code properly, while with spaces that extra step has more optionality and is only needed in order to <i>edit</i> the code with auto-indent.<p>IMO since one has to adapt their coding style to the dominant style of the codebase (single&#x2F;double quotes, etc.) either way, one might as well adapt to the indentation as well, so I’m not against spaces.<p>And of course, due to people who don’t take care to set up their tooling and end up mixing tabs and spaces for indentation, a particularly hot mess can arise—and what’s worse, that mess can accidentally <i>look fine</i> in editors that happen to be configured in a particular way. Because of that, I keep whitespace visibility turned on across my editors.
评论 #27181364 未加载
xdrosenheimabout 4 years ago
This is clearly because people who use spaces, lie about their income.
评论 #27181155 未加载
评论 #27184776 未加载
评论 #27182240 未加载
评论 #27181268 未加载
elihuabout 4 years ago
I think there&#x27;s a general trend where C programmers generally are near the bottom in terms of salary, and I think a disproportionate amount of C programmers probably use tabs (due to the popularity of the Linux kernel style).<p>Or in other words: I know who&#x27;s pulling down the average because it&#x27;s me.
评论 #27181584 未加载
评论 #27181446 未加载
eckesicleabout 4 years ago
I suspect that this is partially caused by the fact that &#x27;spaces&#x27; is the non-default choice in many standard IDEs such as Eclipse and the rest of its enterprise friends.<p>Software engineers who make active choices in their setup rather than just accept default configurations and tools tend to be better at other aspects of their job too?
nyuszika7habout 4 years ago
There are plenty of reasons for preferring spaces:<p>* There will always be that one diff tool&#x2F;website which doesn&#x27;t support configuring the tab width and renders your code with 8-space tabs. Even if every tool you use supports configuring this, it&#x27;s going to be a nightmare to configure every single tool when the default of 8 is <i>not</i> sane for the majority of people.<p>* If you enforce a maximum line length for your code, people who use a different tab width than you are bound to mess this up. I mean, you can somewhat avoid it with an automated linters, but then again, which tab width do you set it for? If you set it too low, it will look bad people with bigger tab widths working on a split screen. If you set it too high, code will be unnecessarily wrapped everywhere and it will look bad.<p>* Mixing tabs and spaces to ensure proper alignment of function arguments with any tab width can be a nightmare. Someone on your team is definitely going to mess it up eventually, and you&#x27;ll have to clean up after them. With spaces enforced, indentation and alignment will look the same everywhere and mistakes will be immediately obvious regardless of the tool used for code review. (Editors may support differentiating tabs visually, but I don&#x27;t think GitHub or GitLab does.)<p>On a team project, you don&#x27;t get to choose other things like brace style either. You just have to learn to deal with it. There are too many variables to account for, such as the ones I mentioned above. Using spaces ensures consistency everywhere.<p>In an ideal world, you wouldn&#x27;t have to worry about all this, you would just store a minified version of the code and your editor could format it with your preferred tab width, line length, brace style, etc. But in reality, it&#x27;s not that simple. Auto-formatters are far from perfect.
FriedrichNabout 4 years ago
It might have to do with the fact that people who use tabs have stronger principles (indentation should be one char!) and people with strong principles will generally have more conflicts with their colleagues and bosses. Usually conflict isn&#x27;t good for salary negotiations or keeping a job.<p>That&#x27;s my 100% unscientific, non-evidence based guess.
评论 #27181151 未加载
评论 #27181164 未加载
评论 #27181156 未加载
maury91about 4 years ago
Joke: Devs are paid by how many buttons they press, devs who use spaces press the spacebar a lot!
评论 #27181176 未加载
totalZeroabout 4 years ago
I&#x27;m surprised they didn&#x27;t normalize for age, which is correlated with income up to a certain point and then drops off.
评论 #27181212 未加载
benrbrayabout 4 years ago
Probably needs a (2017). Past discussion [1,2].<p>[1] <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=14560042" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=14560042</a><p>[2] <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=20718031" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=20718031</a>
评论 #27181104 未加载
isitdopamineabout 4 years ago
Since some very popular languages (Python) actively discourage using tabs, this is most likely related to a difference in language choices, rather than in a genuine indentation preferences.
tffggabout 4 years ago
My editor and IDEs convert tabs to spaces...
评论 #27181101 未加载
pitchedabout 4 years ago
I’ve noticed this before too! I think it’s because spaces are just lazier. Tabs might be more flexible but they do take a bit more effort. Someone who puts more effort than needed into one thing won’t stop at tabs.
评论 #27181136 未加载
评论 #27181107 未加载
评论 #27181102 未加载
评论 #27181106 未加载
paulolcabout 4 years ago
Don&#x27;t get lured by the Dark Side! Accessibility is the real reason you must use tabs instead of spaces for indentation [1]. Yes, it&#x27;s evident that Accessibility is not valued and that it&#x27;s easier&#x2F;cheaper to not care. We should start to care. Maybe it doesn&#x27;t even cost that much. Just by flagging it on formatting commit hooks or in some plugin in static analysis tools like Sonar, would go a long way in raising awareness and improving this.<p>Developers with visual impairment have different needs regarding indentation. One could need a tab-width of 1 due to the use of gigantic font size and the other a tab-with of 8 because of a wide monitor.<p>[1] Nobody talks about the real reason to use Tabs over Spaces <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=20381027" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=20381027</a> <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=20341354" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=20341354</a>)<p>Previous threads <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=20381027" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=20381027</a> <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=20341354" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=20341354</a>
评论 #27184921 未加载
crypticaabout 4 years ago
I use 2 spaces for indentation, but I agree that tabs are more logical. The reason why I switched to using spaces (years ago) is because tabs look terrible when copy-pasting code in a text area in the browser; they look way too big.<p>If everyone chose tab spacing sensibly, then tabs would be ideal but there always seems to be some people somewhere who will exploit any flexibility provided by any technology to do something retarded.<p>At least with 2 spaces, I have full control over how my code looks everywhere.
vishnuguptaabout 4 years ago
Maybe the causality is inverted?<p>Instead of saying international athletes are more likely to use Nike shoes you end up saying Nike wearers are more likely to be international athletes.
ybbondabout 4 years ago
Actually, I like tab. It gives people more choice on how their code looks like based on their editor&#x27;s preference.<p>But no, I cannot —even sneakily, manually— enforce tab in my company(es) code bases. Reasonable person uses formatter which opinionated config set from the first commit.<p>And I like the formatter decision better. If it is automated and reduce unnecessary debate between devs, why not?
评论 #27187996 未加载
junonabout 4 years ago
If I recall, someone mentioned this was probably because the majority of IDEs come pre-configured to use spaces for indentation over tabs. Therefore, the study is skewed as most people don&#x27;t update their IDE settings unless they&#x27;re particular about them (IME this sounds like it&#x27;s true).
kodahabout 4 years ago
Why do people try to put accessibility arguments on people rather than doing this intelligently per language in the IDE? The functions to convert tabs and spaces (not mention how to represent them) is entirely configurable already. Is there something I&#x27;m missing?
mfbx9da4about 4 years ago
Correlation does not imply causation but very fun title!
u801eabout 4 years ago
Using hanging indents works regardless of whether one uses spaces or tabs. But trying to align text based on the indentation of the opening parenthesis (of it&#x27;s on the same line as the method name) pretty much only works well with just spaces.
mikewarotabout 4 years ago
[Edit: Personal Usage] I use space within text, and TAB&#x2F;Shift-TAB to move between data entry fields. You never know when a TAB key is going to do something weird outside of your home IDE. [&#x2F;EDIT]<p>They missed an axis.... sure you can compare Space vs Horizontal Tabs, but what about Line feed vs Vertical tabs? Form feeds are similarly overlooked.<p>Also missing is the lf &#x2F; cr-lf debate 8)<p>PS: Does anyone use Group, Record, or Unit Separators?<p>Reference: <a href="https:&#x2F;&#x2F;theasciicode.com.ar&#x2F;ascii-control-characters&#x2F;vertical-tab-male-symbol-mars-ascii-code-11.html" rel="nofollow">https:&#x2F;&#x2F;theasciicode.com.ar&#x2F;ascii-control-characters&#x2F;vertica...</a>
评论 #27188863 未加载
Yizahiabout 4 years ago
Did anyone seen actual &quot;broken&quot; indentation on any system in the last 10 years? (specifically indentation, not mid line breaks filled with tabs) Because that is the only argument for spaces.<p>Personally, I sometimes log onto very old boxes running some old OS and s&#x2F;w, and I&#x27;ve never seen broken indentation display for tabs.<p>I think replacing tabs with multiple spaces was a valid solution in 20th century, but not anymore for last decade at least. Instead it transformed into a cargo cult like obsession, with zero valid reasons today.
评论 #27181524 未加载
评论 #27181586 未加载
dangabout 4 years ago
Some past threads:<p><i>Developers Who Use Spaces Make More Money Than Those Who Use Tabs (2017)</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=20718031" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=20718031</a> - Aug 2019 (148 comments)<p><i>Developers who use spaces make more money than those who use tabs</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=14560042" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=14560042</a> - June 2017 (663 comments)
globular-toastabout 4 years ago
I&#x27;m someone who uses spaces, but knows I should be using tabs.<p>In other sad missed opportunities, see the ASCII delimiters: <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Delimiter#ASCII_delimited_text" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Delimiter#ASCII_delimited_text</a><p>That&#x27;s right, four levels of delimiters, built in to <i>ASCII</i>! No unicode required. Instead of that we get CSV, with in-band delimiters and the resulting god awful quoting rules that go with that.
Stranger43about 4 years ago
The question here is what space vs tab use is actually an proxy, which is a question you generally need to ask when you get weird but valid statistical results.<p>If there for instance was an correlation between having lived though the bad old days with primitive build&#x2F;formatting tool chains and a preference for spaces that would easily explain a difference in salary that have nothing to do with the argument for&#x2F;against tabs&#x2F;spaces as it relates to modern tooling.
hankchinaskiabout 4 years ago
Chocolate consumption per capita is positively correlated with the stock of Nobel prizes per capita [0]<p>[0] <a href="https:&#x2F;&#x2F;www.sciencedirect.com&#x2F;science&#x2F;article&#x2F;pii&#x2F;S2590291120300711" rel="nofollow">https:&#x2F;&#x2F;www.sciencedirect.com&#x2F;science&#x2F;article&#x2F;pii&#x2F;S259029112...</a>
评论 #27181529 未加载
mnd999about 4 years ago
What about developers who follow the coding standards because they value consistency over personal preferences?
EVa5I7bHFq9mnYKalmost 4 years ago
I use spaces because long ago I had two editors, one of which showed a tab as 4 spaces, and the other - as 8. So spaces provided consistency, that&#x27;s all. Maybe older developers prefer spaces for that reason, hence the salary gap?
yummybearabout 4 years ago
Are there languages that lend themselves more to space-indentation? That could explain the wage gap.
评论 #27181242 未加载
评论 #27181692 未加载
hackerbabzabout 4 years ago
I don&#x27;t even know what I use. It probably changes in different repositories. I&#x27;ve never cared enough to check or set it one way or the other, and definitely don&#x27;t care enough to have a 20 minute meeting with my team to decide.
mclightningabout 4 years ago
Developers who are not stuck on the argument of this duality are making even more.
评论 #27183443 未加载
trogabout 4 years ago
Is there a group of developers somewhere that charge per byte of code they write?
renewiltordabout 4 years ago
Maybe it’s “Developers who care about tabs v spaces spend more time on that discussion and therefore make less money than those who go with the defaults (all spaces)”<p>A.k.a The Market Hates Bikesheds
Ballasabout 4 years ago
Might be unfounded, but my personal theory is that the correlation might be something as simple as companies that adopt (for instance) the Google C++ coding style guide pay more.
Threeve303about 4 years ago
This is why early languages had no white space at all. &#x2F;s
zelphirkaltabout 4 years ago
But how do they write makefiles? <i>hard thinking face</i>
评论 #27181126 未加载
thanatos519about 4 years ago
Tabs ... of acid? :-P
jl2718about 4 years ago
In the beginning, there was only tabs, and all indentation was exactly one tab greater than the prior context.<p>Then, a few people started doing tabs and then spaces to indent their function arguments to align with the opening parenthesis of function arguments. Why? Because it looks like a windows drop-down menu hierarchy, opening the sub-menu to the right of the selection. These people tend to be UI-focused, heavy PowerPoint users, CS 101 teachers, and management types.<p>This was okay when everybody was using MSVC or Visual Basic (no Unix person would do this), and so tabs-then-spaces code crept into everything. Tab purists were at worst mildly annoyed. There was no such thing as a space purist. They would have been physically assaulted for banging on a mechanical space bar that many times in a cubicle office.<p>But if you opened up that file in notepad.exe, or wordpad.exe, or TextEdit, or Borland or vi or emacs or any other text editor, you would get a preview of the chaos that was about to be unleashed. When the web became popular, the standard programming environment for a lot of people became “right click -&gt; view source”. Space width was all over the place. Tab width was blowing text off the page. Word wrap was horror, and saving a file in word wrap mode saved the imputed carriage returns.<p>But that was still just aesthetics. When python became popular, it changed behavior. Python tried to adapt by allowing many different styles of indentation. It worked most of the time, but not all the time. This is how it turned into a full-on war.<p>It is easy to convert tabs to spaces, and hard to go the other way. So naturally, people wrote a simple script to convert tabs to the right number of spaces. Then immediately the number of key bangs rose to a deafening roar. Nerf sales went through the roof as the office became a war zone. The accountants were still using pencil and notebook.<p>So people tried to write scripts to convert back to tabs. Hahahaha mortal. You can never go back. Your attempts are futile and the one bug you introduce will be your undoing. Foolish tab purist! Come to the dark side and embrace the space. Yesssss... see that giant bar at the bottom of your keyboard? Hit it! Again! Louder! What’s that? You made a mistake? Lost count? Start over! Hahahahahaha!<p>Then editors changed to no longer record your keystrokes, but instead try to guess at what you mean and show you what it wants you to have meant. These editors have other great features to churn out reams of code that nobody will ever be able to review or keep up with, which is the key to leading a project and getting that promotion. The worse the code, the more people you’ll have to manage to get it working.<p>Meanwhile, tab purists are an exiled minority, unable to find anybody to work with, begrudgingly accepting their orders from some young superstar coder that blew out the git log in their first 30 days on the job.<p>Oh the lowly tab purist. Go home and seethe; you are defeated. Watch again one of the five movies you own on your Betamax or HD-DVD. Better standards? Hahahaha!
评论 #27208525 未加载
评论 #27186571 未加载
King-Aaronabout 4 years ago
Correlation and Causation something something
d--babout 4 years ago
Wait, there are still people who use tabs?
评论 #27181264 未加载
评论 #27192004 未加载
thenoblesunfishabout 4 years ago
Do employers who tend to pay more (e.g. Google) tend to have style guides which encourage spaces over tabs?
hpenabout 4 years ago
Just use a code formatter and half the issue highlighted in these comments disappear
alephnanabout 4 years ago
Because Google engineers use spaces, even after they leave Google
iamgopalabout 4 years ago
Which should be the correct way ? Space or Tabs ?
评论 #27181635 未加载
评论 #27181287 未加载
tmccrary55about 4 years ago
What about people who use tabs and spaces?
评论 #27181129 未加载
评论 #27181271 未加载
评论 #27181110 未加载
iovrthoughtthisabout 4 years ago
where do all the people who use spaces work?<p>is one (or some) high paying companies coding practices skewing the results?
alanchenabout 4 years ago
Correlation != Causality
abcdasfweabout 4 years ago
i&#x27;m a python dev, and i don&#x27;t agree with this
traceroute66about 4 years ago
Surely this nonsense is a textbook example of statistical overfitting ?
评论 #27181174 未加载
blarg1about 4 years ago
What if I use both?
aviparsabout 4 years ago
What about IQ
Cerebrum1234about 4 years ago
Programmers who use spaces &#x27;paid more&#x27;· Computer programmers who use spaces as part of their coding earn.
wavegeekabout 4 years ago
This is because they are<p>a) More smart<p>b) More correct.<p>It is not that complex.<p>Also they are more likely to be using emacs, another big win.
评论 #27182107 未加载
raverbashingabout 4 years ago
That&#x27;s like saying people who use &quot;import&quot; clauses make more money than those who use &quot;requires&quot; clauses.<p>I don&#x27;t even know why this is a discussion, if ASCII has a character that represents an indent, we might as well use it (unless you prefer typing &amp; as Et, &lt; as LessThan, etc)<p>That being said, yes, using spaces for arbitrary alignment is easier