TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

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

92 点作者 nan0将近 6 年前

41 条评论

dschnurr将近 6 年前
Hopefully nobody uses an article like this to really inform their decision on which to use.<p>Last month there was a reddit discussion that outlined some really compelling accessibility-related reasons to use tabs, worth a read: <a href="https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;javascript&#x2F;comments&#x2F;c8drjo&#x2F;nobody_talks_about_the_real_reason_to_use_tabs&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.reddit.com&#x2F;r&#x2F;javascript&#x2F;comments&#x2F;c8drjo&#x2F;nobody_t...</a>
评论 #20718651 未加载
评论 #20721480 未加载
评论 #20746861 未加载
评论 #20719474 未加载
lukev将近 6 年前
All the tab advocates in this thread are like &quot;Tabs are great, all you have to do is...&quot;<p>That&#x27;s why spaces are better. There&#x27;s no &quot;all you have to do.&quot; There&#x27;s nothing. Just use spaces. Your code will look fine everywhere. Done.<p>Separation of content and presentation is a fine principle for many things, but as long as we&#x27;re coding using text files, we are already far removed from that world. May as well stay simple and embrace the literal characters.
评论 #20720115 未加载
crazygringo将近 6 年前
I think the biggest and most obvious control is missing here -- the company they work for.<p>Much more likely is that companies that pay more, for whatever reason, insist on spaces rather than tabs as a required coding style.<p>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.
评论 #20719297 未加载
评论 #20719346 未加载
评论 #20721417 未加载
dvt将近 6 年前
I prefer spaces purely out of consistency reasons.<p>Some systems say a tab is 8 spaces, others say it&#x27;s 4. Some editors can set a tab to any customizable N spaces. But a space is <i>always</i> a space so your code will look like you intended (or should I say indented) it no matter who&#x27;s looking at it.
评论 #20718366 未加载
评论 #20718503 未加载
评论 #20718731 未加载
wwweston将近 6 年前
In case anyone wonders why someone might answer &quot;both&quot; (other than an entirely undisciplined approach):<p>Tabs for line indentation, spaces for every other kind of alignment is one philosophy. It&#x27;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).<p>But if you&#x27;re running the project and decide spaces are The One True Way™, I&#x27;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). ;)
评论 #20718257 未加载
评论 #20718519 未加载
评论 #20718356 未加载
评论 #20719531 未加载
rhacker将近 6 年前
Wouldn&#x27;t this make sense?<p><a href="https:&#x2F;&#x2F;medium.com&#x2F;@hoffa&#x2F;400-000-github-repositories-1-billion-files-14-terabytes-of-code-spaces-or-tabs-7cfe0b5dd7fd#.j6ki2b7og" rel="nofollow">https:&#x2F;&#x2F;medium.com&#x2F;@hoffa&#x2F;400-000-github-repositories-1-bill...</a><p>So the number of people that prefer spaces far outweighs the tabbers.<p>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.<p>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&#x2F;Space approach. Which is absolutely horrifying in my personal opinion. I don&#x27;t have any numbers but Eclipse probably holds 80%, followed by Netbeans and&#x2F;or IntelliJ. (both of which default to spaces)
评论 #20718318 未加载
评论 #20718692 未加载
inanutshellus将近 6 年前
This has come up before. My theory is this:<p>Tabs are great if you work by yourself. If you work with others, you need more complicated rules to be followed like &quot;tabs for indentation, spaces for alignment.&quot;<p>So...<p>My theory is that coders using spaces have worked in more places and&#x2F;or larger places, which tend to end up paying more.
评论 #20718730 未加载
评论 #20718598 未加载
评论 #20718726 未加载
评论 #20719210 未加载
TimTheTinker将近 6 年前
I strongly favor spaces, because using tabs adds one more thing to worry about when writing code to be read by others.<p>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 &quot;Will this be readable by colleagues who prefer 2-wide tabs vs. 4-wide tabs?&quot; We just adopt a convention (2 or 4 spaces) for each codebase and run with it.<p>Similarly, when others have used spaces, it&#x27;s one less thing to worry about when starting work on a new codebase. There&#x27;s no evaluating &quot;will this codebase look better with 2-wide or 4-wide tabs?&quot; or &quot;Can I override the default tab width with my preference, or will that make this codebase less readable?&quot;
评论 #20719641 未加载
评论 #20719932 未加载
vbtemp将近 6 年前
It&#x27;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.<p>Edit: It&#x27;s also kind of funny how people in this thread are making it seem like there&#x27;s some kind of controversy. There isn&#x27;t: the question was settled a long time ago.
m463将近 6 年前
This can be summed up &quot;developers with experience with others use spaces&quot;<p>Tabs do not interact well with teams.<p>Spaces are a source of consistency for teams.<p>Basically, spaces have the same indentation for everyone sharing code while tabs do not.<p>To set up spaces only in your editor requires a mindful effort.<p><a href="https:&#x2F;&#x2F;www.jwz.org&#x2F;doc&#x2F;tabs-vs-spaces.html" rel="nofollow">https:&#x2F;&#x2F;www.jwz.org&#x2F;doc&#x2F;tabs-vs-spaces.html</a>
erichurkman将近 6 年前
Or 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&#x27;s black._<p>[0] <a href="https:&#x2F;&#x2F;black.readthedocs.io&#x2F;en&#x2F;stable&#x2F;" rel="nofollow">https:&#x2F;&#x2F;black.readthedocs.io&#x2F;en&#x2F;stable&#x2F;</a>
评论 #20718774 未加载
benttoothpaste将近 6 年前
I&#x27;ve always suspected that &quot;go fmt&quot; is a tool of income suppression...
maxk42将近 6 年前
My personal preference is tabs and the reason I never hear given is that I simply don&#x27;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&#x27;s easy. When I&#x27;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&#x27;ll pardon the formatting:<p><pre><code> if(cond) { flag = true; } else { flag = false; } </code></pre> can often be represented as just:<p><pre><code> flag = false; if(cond) { flag = true; } </code></pre> and in languages that initialize variables, often the first line can be omitted as well.<p>I just feel like I&#x27;m stuck in molasses, having to go through several extra steps whenever I&#x27;m writing code that compels the use of spaces over tabs. That said: It&#x27;s a personal preference and I&#x27;ll use spaces where appropriate.<p>Most people&#x27;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.<p>Example:<p><pre><code> tabtabtabtabType myArray[] = { tabtabtabtabtab 123, 456, 789, 101112, tabtabtabtabtab131415, 161718, 192021, 222324 tabtabtabtab}; </code></pre> It&#x27;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&#x27;re going to have a bad time.
评论 #20719662 未加载
评论 #20719622 未加载
robocat将近 6 年前
From 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?<p>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.<p>Sampling bias is difficult to avoid in the best designed research.
jshprentz将近 6 年前
Back 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.<p>James L. Peterson, James R. Bitner, and John H. Howard, ``On the Selection of Optimal Tab Settings&#x27;&#x27;, Communications of the ACM, Volume 21, Number 12, (December 1978), pages 1004-1007.<p><a href="http:&#x2F;&#x2F;jklp.org&#x2F;profession&#x2F;papers&#x2F;tab&#x2F;paper.html" rel="nofollow">http:&#x2F;&#x2F;jklp.org&#x2F;profession&#x2F;papers&#x2F;tab&#x2F;paper.html</a>
rfer34f将近 6 年前
That 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, <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> if you&#x27;re visually impared, using spaces make for poor accessibility. Don&#x27;t be a dick, use tabs!
natvert将近 6 年前
Ok, but 2 or 4 spaces?!
评论 #20718478 未加载
评论 #20719279 未加载
评论 #20718462 未加载
spacehunt将近 6 年前
If I&#x27;m reading the chart correctly, it seems that Go developers who use spaces rather than tabs actually earn more? That&#x27;s quite surprising.
评论 #20718690 未加载
ChrisSD将近 6 年前
More people drown after having eaten an ice cream.
评论 #20718337 未加载
评论 #20718398 未加载
awkward将近 6 年前
I 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.
jaequery将近 6 年前
Those who prefer tabs have clearly not experienced the nightmare of collaborating with devs who were using spaces.
评论 #20718654 未加载
Bootwizard将近 6 年前
So where does using the &quot;tabs to spaces&quot; tool lie here?<p>I technically press the tab button but my edit inserts 4 spaces.
评论 #20718426 未加载
评论 #20718891 未加载
robbrown451将近 6 年前
It 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.<p>So people sticking with tabs are more typically &quot;old-school&quot; and stubborn in all their approaches. And that can explain the pay difference.
评论 #20719356 未加载
jaequery将近 6 年前
This is why the world will never make peace. If we can’t even agree on something silly as tabs vs spaces.
评论 #20719428 未加载
firemelt将近 6 年前
I really don&#x27;t understand the war behind this I always pressing tab button when I want to tabs(giving more than one space) things<p>Does the war is about pressing tab button vs space button?<p>Or is it about the underlying of it?<p>Afaik when We press the tab button the editor is sending a space right? Then what&#x27;s with the fuss?
adchari将近 6 年前
I 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&#x2F;level&#x2F;experience, not their choice of indentation?
评论 #20718720 未加载
评论 #20718691 未加载
crtlaltdel将近 6 年前
i 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 ;)
writepub将近 6 年前
Which 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
评论 #20718946 未加载
评论 #20720013 未加载
travbrack将近 6 年前
* based on one survey of self-reported data
commandlinefan将近 6 年前
Probably because they can read their code.
sideshowmel将近 6 年前
:set expandtab
评论 #20718086 未加载
dep_b将近 6 年前
And what about developers that add spaces by using the TAB-key?
评论 #20719293 未加载
Koshkin将近 6 年前
4x or 8x ?
qzygr将近 6 年前
I like tabs because it allows developers to configure their editors with whatever width they desire.
评论 #20718592 未加载
tcmb将近 6 年前
(2017)
leerob将近 6 年前
For all my JavaScript developers - just gonna leave this here.<p><a href="https:&#x2F;&#x2F;standardjs.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;standardjs.com&#x2F;</a>
Grustaf将近 6 年前
Can confirm
beardedProgmr将近 6 年前
Those salaries are painfully low. I started at 75k. Who&#x27;s making less than 50k and in such great numbers? This must be non US jobs? I question this data.
评论 #20718752 未加载
评论 #20718513 未加载
评论 #20718805 未加载
stephc_int13将近 6 年前
Am I the only one who doesn&#x27;t give a fuck?<p>Is it really a subject?<p>And I&#x27;m not saying that code aesthetics doesn&#x27;t matter, I tend to obsess over good typography and alignment, but I use both tabs and spaces, switching depending on the code-base&#x2F;context, without even thinking about it.
评论 #20719072 未加载
buboard将近 6 年前
Thats racist<p>It&#x27;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.
nemetroid将近 6 年前
I would be fine with using spaces if it weren&#x27;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:<p>&gt; 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&#x27;re screwed anyway, and should fix your program.<p>&gt; In short, 8-char indents make things easier to read, and have the added benefit of warning you when you&#x27;re nesting your functions too deep. Heed that warning.