Stack Overflow 2015 Developer Survey Reveals Coder Stats
SternisheFan points out the results from 26,086 developers who answered Stack Overflow's annual survey. It includes demographic data, technology preferences, occupational information, and more. Some examples: The U.S. had the most respondents, followed by India and the UK, while small countries and several Nordic ones had the most developers per capita. The average age of developers in the U.S. and UK was over 30, while it was 25 in India and 26.6 in Russia. 92.1% of developers identified as male. Almost half of respondents did not receive a degree in computer science.
The most-used technologies included JavaScript, SQL, Java, C#, and PHP. The most loved technologies were Swift, C++11, and Rust, while the most dreaded were Salesforce, Visual Basic, and Wordpress. 20.5% of respondents run Linux more than other OSes, and 21.5% rely on Mac OS X. Vim is almost 4 times more popular than Emacs, and both are used significantly less than NotePad++ and Sublime Text.
45% of respondents prefer tabs, while 33.6% prefer spaces, though the relationship flips at higher experience levels. On average, developers who work remotely earn more than developers who don't. Product managers reported the lowest levels of job satisfaction and the highest levels of caffeinated beverages consumed per day.
The most-used technologies included JavaScript, SQL, Java, C#, and PHP. The most loved technologies were Swift, C++11, and Rust, while the most dreaded were Salesforce, Visual Basic, and Wordpress. 20.5% of respondents run Linux more than other OSes, and 21.5% rely on Mac OS X. Vim is almost 4 times more popular than Emacs, and both are used significantly less than NotePad++ and Sublime Text.
45% of respondents prefer tabs, while 33.6% prefer spaces, though the relationship flips at higher experience levels. On average, developers who work remotely earn more than developers who don't. Product managers reported the lowest levels of job satisfaction and the highest levels of caffeinated beverages consumed per day.
well i don't work for you, and i know how to configure editors to keep tabs as tabs. so i guess i win on two counts.
> Software development has a gender balance problem. Our internal stats suggest the imbalance isn't quite as severe as the survey results would make it seem, but there's no doubt everyone who codes needs to be more proactive welcoming women into the field.
SJWs have spent decades telling women they need "special help" to become engineers and programmers. We can't overcome that by being "welcoming" because they chose a different path before college. Even without the SJW discouragement campaign, it's clear that women are choosing more rewarding fields that better fit their preferences. Staring at code all day isn't for everyone, just like working with babies all day would drive me mad. Different jobs for different folks, and we should all be glad for the variety.
Just stop telling me this is all my fault, StackOverflow.
As a fairly experienced and slightly wrinkly and grey developer, can anyone tell me why spaces over tabs?
Tabs allow the developer to customise their IDE to display the amount of indentation they desire... and use fewer bytes... spaces seem to have no benefits whatsoever in my book.
Once upon a time, tabs were wonderful. Because disks held 80 kilobytes and ANYTHING that could put more code/data on a disk was wonderful, as long as you had the RAM/CPU to deal with it.
Those days are long gone, however.
The nominal expansion of tabs is to advance to the next column which is a multiple of 8. That's presupposing "absolute" horizontal tabs, as opposed to the less-common relative horizontal tab (RHT).
But 8 columns is a really awkward amount to indent things, especially if you're dealing with letter-sized printouts at 10 characters per inch. A much more pleasant value is usually to tab in increments of 3 or 4 columns.
And, as others have pointed out, the 8-character convention is really just a convention. There's always someone who sets their hardware tabs or tab displays differently.
And then there's Python, which gets its magic from careful indentation. Meaning that a listing that looks fine on-screen or on paper may bewilderingly not run. Because although the alignment of the characters on successive lines may match up, the actual number of spacing characters on those lines might not. And conversely, the alignment can get scrambled just because someone picked a different tab expansion value.
And that is why it's the experienced people who are least fond of tab characters. Once burnt...
Spaces are unquestionably useful in some cases. Tabs need to justify their existence.
I can virtually guarantee if you were inventing the first character set today, with no backward-compatibility constraints and no knowledge of the real world's history of keyboarding, you would not include a tab key. It's a relic of the typewriter era, and it's redundant. You *would* probably have a "change the currently focussed element" key, but I suspect it would be related to the arrow keys and would be positional rather than linear. Word processors would have a different affordance for "indent bulleted list".
Disk space for source code tabs vs. spaces is irrelevant.
To me, the tab character causes problems and the only real problem it solves (different tastes for how much width to indent) are better solved by an IDE which is already solving the same problem in so many other contexts, like syntax highlighting in different colours etc.. An IDE could easily say that a line that starts with a string of X consecutive spaces should be represented as Y consecutive spaces. Y may even be a fraction, or a function if you choose to have tab mean "align to previous", but 2, 4, and 8 fixed-width spaces are pretty common. Personally I like 3, but at my workplace the standard is 4 and that's just fine.
I guess that there are multiple reasons.
The most common one is ignorance: most people don't know how tabs are supposed to be used as indentation and indentation ONLY, and how to set up an editor appropriately (and the shell, by the way) (see the other responses to your comment for proof).
The second is lazyness / non-confrontational behaviour: If you settle on tabs, you will have to educate all users about the correct usage, and have to bear with people that just insist on using tabs differently (see point 1). If you settle on space usage, that's about it.
The third reason is that some editors are stupid, because the implementation doesn't know that tabs are supposed to be used as indentation and indentation ONLY, and will (for example) insist on aligning multi-line arguments to a function just after the parenthesis using a liberal amount of tabs.
And then there are some language requirements that like to mess things up, like Makefile requiring tabs and other scripting languages pursuing a vendetta against tabs (like Python).
That being said, I will gladly educate people about tab usage, their ignorance is no excuse for using inferior solutions.
I have discovered a truly marvelous proof of killer sig, which this margin is too narrow to contain.
You, too, will one day get so frustrated when dealing with impossible-to-read code due to tabs, possibly with formatting that assumes multiple different tab sizes within a single file, that you'll be enlightened and learn to love spaces.
I've been coding way too long to care about indentation bullshit anymore. If a file does not have uniform indentation style, reindent it with a standard tool (*), and then commit the reindent-only change to local git. You can discard the reindent commit if you don't end up making any real changes to the file; otherwise, your patch goes on top of the freshly-indented file.
* = Use your company's indentation guidelines if they exist; otherwise just use the style options that most-closely match the majority of the source tree. Also be aware that some coders in your company may need a refresher on how to tell a diff program how to ignore whitespace changes.
Because tabs are not enough to lay out code well (you always end up with a couple of spaces to align things correctly). Then once you introduce a mixture, you end up in a situation where a change in tab-width causes layout fuckup (i.e. you get fuck ups on a different user's system).
Meanwhile, if you use spaces for everything, code remains well laid out everywhere. If you have even a half-decent editor, it will allow you to edit spaces as if they were tabs, so using spaces has exactly 0 drawback.
Huh? Since when? On typwriters and early word-processors it was forced to 5 columns. And even most typewriters allowed you to move the tabstops to arbitrary places.
On every editor I've seen in the last 5 years the tab display width is configurable. If you like 2 spaces, great, if you like 8, have at it. It doesn't affect the rest of your team.
The only reason tab characters are a problem is because people mix and match tabs and spaces.
Python's whitespacing is an evil that should be purged with fire.
I'm out of my mind right now, but feel free to leave a message.....
Funny, I feel the exact opposite. The FreeBSD style(9) documentation suggests tabs because they can be customized to individual developers needs and they minimize weird diffs on the version control systems.
I take language and platform into account. For HTML and JavaScript, I prefer spaces. For Java, Perl, C#, CSS, C, and C++ tabs. If there is a crazy IDE required, I often prefer spaces because many of them default to some level of spaces and I like the quick code cleanup command to work the same for the whole team.
The real issue with that question is that it's impossible to answer. Even if you get a "spaces" person, try to get them to agree on the number of spaces. A coworker loves 2 spaces which is flat out wrong to me. Too hard to read. I've met people into 3 or 4 spaces. Then you get into where to put curly braces, etc.
Whatever you choose, it should be a standard for code whether at an open source project or a company.
I can't stand everyone using their own style. It's much worse than having to use a specific one.
MidnightBSD: The BSD for Everyone
This debate only happened because some programmers stopped thinking about the indentation abstraction. You shouldn't be thinking in terms of spaces vs tabs. Instead you should be thinking in levels of indentation for blocks. Indentation is not some technique to make your code look pretty, it's there to show a clear separation of logic, loops, blocks etc. Code is art, just not Ascii art. One keystroke per indentation is the simplest and most efficient.
ayottesoftware.com
If I need to know about executeFoo() in SomeLibrary, I can:
I've tried all three, and vastly prefer the simple Google search. Not only will SomeLibrary.com be in the first 3 results (assuming their documentation doesn't suck), but there's a good chance you'll find a StackOverflow thread that not only explains executeFoo, but also covers the caveats and options better than the documentation.
Code samples tend to be more elegant than my own code. Many questions have multiple samples by multiple authors refined by multiple editors over multiple years. In comparison, I find API documentation often turns stale, or the samples are too simple to cover the cases I'm interested in. I don't "spend my life copy-pasting" - code samples tend to be useless for any real-life task. But I do get to see a gallery of how other people have solved similar problems.
Last post!
Javascript and AngularJS and NodeJS? If you're using one of the latter, aren't you using the former by definition? And also, while I have nothing against Angular (learning at the moment myself), is it really more-used than jQuery? I see jQuery all over the place when I look into the source of sites I find interesting, far more often than I run into Angular.
"The Greens lynched a hacker in Chicago. Last month, but I think the body's still hanging from the old Water Tower."
You can't continue to have that patriotism in view of the observable facts - your government is by the few, for the few, and the people be damned. I agree that it's great that a government was founded with these ideals - but as laid out in the constitution, the time would seem to have come to throw what you have away and replace it with a government for the people again.
True patriotism would be revolution.
YOU'RE DOING IT WRONG!!!
Seriously that's a guaranteed path to failure. If you stick to tabs only for indenting at the block level and spaces for any further alignment then it works perfectly. That way changing the tab stops only changes the block-level indent. Any further formatting is done with spaces.
Tabs are logically block-level so they should only be used for block level. If you're aligning relative to text, you need spaces because that's not a block level thing.
The rule is simple and if only everyone would find Jesus^W^Wlearn the rule then we would all achieve peace on earth^W^W^Whaving no commits which change all the whitespace.
PS: use vi.
SJW n. One who posts facts.