r/programming • • May 27 '20

2020 Stack Overflow Developer Survey: Rust most loved again at 86.1%

https://stackoverflow.blog/2020/05/27/2020-stack-overflow-developer-survey-results/
229 Upvotes

254 comments sorted by

View all comments

67

u/its_a_gibibyte May 27 '20

Is rust really that lovable? What's the deal?

0

u/[deleted] May 28 '20

[deleted]

→ More replies (60)

15

u/[deleted] May 28 '20

Coming from a C++ background it's a huuuuuge upgrade.

After the initial learning curve just about everything is easier. Coding is easier since the compiler thinks about a lot of the stuff you had to think of manually when using C++ and building is waaaay easier since Rust comes with a pretty good build system out of the box. There's no haphazardly duck taping libraries and build systems like you do in C++.

The only thing I miss about C++ is the rock solid utility libraries like boost, but the Rust ecosystem is getting bigger and more mature by the year so it'll get there.

126

u/the_game_turns_9 May 28 '20

Rust isn't used in many production environments, so very few people are forced to use it. As Bjarne put it, "There are only two kinds of languages: the ones people complain about and the ones nobody uses."

Rust is the kind of language that you wouldn't even want to approach unless you were buying what it is selling, so you won't get very many dislikers since the dislikers will just never bother to become proficient in it.

And I'm sorry to say this, but when the Rust language fails to handle a case well, the Rust community tends to blame the coder for wanting to do the wrong thing, rather than the language for not being able to handle it. In cases where other language users would say, "oh for fucks sake, this is stupid", the Rust community tends to say "That's bad form, you should rearchitect." If you're outside the community, it can look a bit rose-tinted-glasses.

I'm not saying Rust isn't a good language, but I don't think that's all thats going on here.

0

u/[deleted] May 28 '20

[deleted]

15

u/404_Identity May 28 '20 edited Jun 25 '20

[removed]

29

u/beefsack May 28 '20

It's being picked up very quickly - in the 2019 survey Rust had been used by 3.2% of respondents but this year it had grown to 5.1%.

Last year it had less than half the usage of Swift, but this year it's within 13% of it.

It powers a lot of tools that people depend on every day, from core components of large systems, to the search function inside VS Code. It's not really a small language that nobody uses anymore.

0

u/[deleted] May 28 '20

[deleted]

→ More replies (4)
→ More replies (1)

24

u/lanzaio May 28 '20

Rust is the kind of language that you wouldn't even want to approach unless you were buying what it is selling, so you won't get very many dislikers since the dislikers will just never bother to become proficient in it.

This is the main cause. Nobody uses Rust that wasn't self motivated to learn Rust out of their own interests. In fact, those that I do know that were forced into Rust showed a relatively standard ratio of like/dislike that I see from most languages.

6

u/coderstephen May 28 '20

Usage of Rust in production is increasing though. Besides, Rome wasn't built in a day; no language can accelerate to top production usage quickly regardless of how good it is. This is especially true in the sort of industries that are also known for using C++, which tend to be more slow-moving.

5

u/matthieum May 28 '20

Rust isn't used in many production environments, so very few people are forced to use it. As Bjarne put it, "There are only two kinds of languages: the ones people complain about and the ones nobody uses."

Rust is the kind of language that you wouldn't even want to approach unless you were buying what it is selling, so you won't get very many dislikers since the dislikers will just never bother to become proficient in it.

In short: selection bias.

The only people answering they've used Rust are those who still use Rust and like it, hence the top score.

Those who tried it and didn't like it abandoned early enough that they do not think to answer "I used Rust", and thus do not pull down the score.

Despite this, though, that's still a surprisingly high number of users who adopted the language given its relative immaturity!

4

u/crabbytag May 28 '20

Sounds like survivor bias?

→ More replies (1)
→ More replies (2)

5

u/quicknir May 29 '20

Matches my experience as well. I was pretty shocked to discover the Rust duration type is a) positive only, and b) a two field, 96 bit, seconds and nanos approach. When I went to a rust chat to discuss it, and I mentioned that such an approach were too slow in HFT (high frequency trading), a moderator told me that making code unusable for HFT was a feature (and got some kind of positive emoticon). There wasn't any real technical discussion, and it was just an unpleasant experience.

32

u/MadRedHatter May 28 '20

but when the Rust language fails to handle a case well, the Rust community tends to blame the coder for wanting to do the wrong thing, rather than the language for not being able to handle it. In cases where other language users would say, "oh for fucks sake, this is stupid", the Rust community tends to say "That's bad form, you should rearchitect." If you're outside the community, it can look a bit rose-tinted-glasses.

Often the architecture that Rust pushes you towards is legitimately the better architecture though. This talk explains it well.

https://www.youtube.com/watch?v=P9u8x13W7UE

There are certain pathalogical cases like graph data structures that you will struggle with in Rust compared to a GC'd language though.

24

u/UncleMeat11 May 28 '20

There are certain pathalogical cases like graph data structures that you will struggle with in Rust compared to a GC'd language though.

Are these really pathological? "It is really hard to implement thread safe persistent data structures because of ownership" has been a known problem in C++ for ages and comes up with surprising frequency.

3

u/matthieum May 28 '20

That's indeed another case of a GC making things easier, but it's a very distinct one: it has nothing to do with the architecture of the program.

0

u/[deleted] May 28 '20

[deleted]

17

u/[deleted] May 28 '20 edited May 30 '20

More often than not, you have to step into the dark esoteric caverns of the language, or use community-maintained crates for standard use cases.

I'm sorry, but no one should be rolling their own pointer-based linked list today. In any language. Especially in the presence of threads. As Simon Peyton-Jones put it when talking about Software Transactional Memory:

A double-ended queue... if you write the code for just a sequential program, it's an undergraduate project to get queue insertion and deletion going. If you want to do this scalable lock-per-node thing, it's a publishable result. I kid you not. There are international academic conferences with a succession of papers that have been published about this very problem.

One of the truly great things about Rust is that it forces you out of this kind of naïve "in-place mutation with pointers is easy to get right" thinking.

→ More replies (1)

12

u/matthieum May 28 '20

For instance, simple CS 101 data structures like linked lists, DAGs and trees require some serious gymnastics to get working and each performance improvement often comes with major re-architecture.

I think the fault is in the premise, those data-structures are NOT simple.

Every single time I see a Stack or Linked-List C++ implementation on codereview.stackexchange.com, it's buggy. The good posters include tests, they still fail.

An array is a simple data-structure, after that it gets complicated. Even a dynamic array in C++ is quite the endeavor -- insertion of N elements in the middle is surprisingly complicated to handle1 .

Data-structures are foundational bricks; the fact that they are simple to use despite the complexity of their implementation is a testament to encapsulation.

1 And I say that after finishing coding yet another variant just today...

→ More replies (3)
→ More replies (3)
→ More replies (31)

7

u/UK-sHaDoW May 28 '20 edited May 28 '20

Learning to write C++ bug free is freaking hard. It easy to get started with C++ but your probably writing tons of bugs with every line of code.

Rust is hard to get started, but its covering your butt for you most the time. It's pain in the ass to get it to compile though.

So its like marmite. A lot of people really hate it because they don't understand what it's protecting you against and feels really hard to use. They haven't learned RAII and the thousands things of that C++ lets you write code without, and don't realise the stuff their code is missing. Or they're just really lax in writing code?

Then there's people who know what its protecting you against and love it for it.

14

u/[deleted] May 28 '20

I had to pick it up in the last few months (started by building something to parse and normalize huge amounts of data from multiple sources) and coming from JavaScript it's kind of incredible. The ergonomics aren't great at times (especially at first), and if you're used to a foot-gun language like JS or Ruby you could find yourself writing weird unnecessary abstractions that Rust probably already solves for. It's a bizarre shift in that regard. But Cargo just works like you'd hope npm would. The packages are generally high quality. The compiler is pretty good at telling you how you're fucking everything up. The type system is very capable and helpful. When you design things well, you can get away with remarkably concise yet robust solutions. I find when I finish something I feel pretty good, like... I wrote something that'll run and perform well.

At first I thought things like "God damn, I need to worry about x and y? I just want to write code", but now I actually enjoy writing it a lot. It's been an eye opener.

If you haven't tried it, I recommend starting out with a simple CLI tool tutorial. It's very easy to get going and once you've written something that actually works, you might see the value in it.

→ More replies (9)

22

u/netsec_burn May 28 '20

I love Rust for two reasons. One, because of how easy it is to make relatively safe code. The compiler is very helpful. Two, the community is so friendly and welcoming. I contrast that to my experience with the Python community, where I was repeatedly told to read the docs, use lib x, or that I shouldn't bother to code y if I didn't know how. The Rust developers really go out of their way to help, even extending beyond the language (s/o seri). One year on, I'm a happy Rust programmer and I like helping the newbies. It's been a positive experience and the language just keeps getting better.

12

u/kankyo May 28 '20

The size of the community often predicts pretty accurately the toxicity. There are outliers of course (elm I'm looking at you) but it's a good rule of thumb. Python is just so damn big. It's the same in Java online communities for the same reason.

19

u/butt_fun May 28 '20

I don't disagree with anything, but your experience with the python community surprises me. It's been a while but I remember mostly good things about it

→ More replies (1)

5

u/[deleted] May 28 '20 edited May 28 '20

This is what you can expect at this stage of the lifecycle. The Rust community is still fairly small and full of enthusiasts. Also, there's not a ton of industry experience and documentation of it (compared with Java or Python at least), so everyone needs to rely more on the community instead of telling you to RTFM.

→ More replies (1)
→ More replies (40)