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.
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.
Different editors display tabs differently.
Some editors replace tabs with N spaces.
Mix the two, and indentation gets all fucked up.
You work for me, you will use spaces.
Spaces are 1 space. Tabs are a random number of spaces.
As a fairly experienced and slightly wrinkly and grey developer, can anyone tell me why spaces over tabs?
Because in every project that uses tabs,
The code is inevitably
littered with
the occasional
line that does not line up with the others
for no apparent reason.
and you will spend part of every day
either changing your editor's tab settings
to match the tab settings of the code's author
or editing the code to "fix" the problem
(which will of course "break" it for the
next person whose tab settings don't match yours)
If you avoid tabs and use only spaces, OTOH, the code formatting will look correct on any editor with any tab setting.
I don't care if it's 90,000 hectares. That lake was not my doing.
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...
Next time you interview someone, the first question out of your mouth should be "Tabs or spaces?!" This way, nobody's fucking time is wasted.
Life is not for the lazy.
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!
tabs are an undefined constant number of spaces. not random.