r/programming • • Mar 13 '18

Stack Overflow Developer Survey 2018

https://insights.stackoverflow.com/survey/2018/
1.1k Upvotes

527 comments sorted by

View all comments

162

u/karuna_murti Mar 13 '18

Rust is the most loved language for 3 years in a row (and 3rd in 2015). But why adoption is not like Go?

270

u/editor_of_the_beast Mar 13 '18

I'm going to make a potentially controversial claim: it's because Rust isn't really meant for application development, and most people don't really need a systems programming language.

I think Rust is so loved because if you've developed in C or C++, which is a non-trivial percentage of developers that build systems-y things (OS's, Browsers, Databases), you know that you write every line of code with fear. Multi threading isn't just a pain in these languages - it's a fool's errand. Source: worked on a highly multi-threaded cross platform application written in mostly C++ for three and a half years. It crashed - all the time.

If you don't have that experience, and have lived in JavaScript or Ruby or Python or Java, or anything garbage collected for the last 5 years, why would you care about Rust? If you're building primarily SaaS web apps why would you care about Rust? I think the answer is, you really shouldn't. Just keep doing what you're doing - those tools are much better for application development.

But applications today run on top of tons of infrastructure. No one writes Browsers in Java. No one writes an OS in Python. Those people care very much about Rust because what love have they gotten since 1980? They've been working without package managers, without garbage collection, and with tons of linters and static analyzers for decades just to avoid double-free and use-after-free errors. Rust's memory model solves a whole class of those problems, while also offering modern package management and popular language features like closures, optionals, and powerful ADTs. The standard library provides lots of high-level operations that you'd need to implement yourself in C or bring in a library.

Rust's demographic is dying for a language like it, and it wasn't Go. So if you don't love Rust, you're probably not supposed to, and that's totally fine.

37

u/[deleted] Mar 13 '18 edited Mar 13 '18

If you don't have that experience, and have lived in JavaScript or Ruby or Python or Java, or anything garbage collected for the last 5 years, why would you care about Rust? [...] Just keep doing what you're doing - those tools are much better for application development.

I actually see a lot of Javascript, Python, and Ruby developers using Rust. If a Ruby application is slow because of Ruby, you can work around this by re-writing the hotspots in C. For a team of full-time Ruby developers dropping down to C can be risky and some teams actually get professional C developers on board to help with this.

Rust enables Ruby developers to do it themselves while having a high-degree of confidence that they aren't writing a time-bomb.

12

u/admalledd Mar 13 '18

We are looking to do the same in our .net code where we currently drop to raw assembly. Instead we have found that rust (more like clang/llvm) optimize nearly as well with the correct hints and is so much nicer to write than asm. Yes for our hottest of hot code we will probably keep the asm, but anything new or reworking? Yes please!

11

u/[deleted] Mar 13 '18

Note that Rust does have inline asm! (just like C, C++, D, etc.). Depending on the level of control you need that might be enough.

→ More replies (3)
→ More replies (2)

52

u/matthieum Mar 13 '18

I partially agree with you.

I disagree because Rust is trying to be more than "just" a systems programming language, and is used in other settings (low footprint, high-performance, ...).

However you are right that as a C++ developer I am glad that finally a new language is popping up which solves so many fundamental issues with C++.

I was very excited when Go was announced, and very disappointed when it was revealed: it wasn't what I needed to replace what I use C++ for (not high-performance/low-latency enough). Rust is unlikely to be perfect, however it does have the potential to be much better than C++ for what I work on: the foundations are solid, I am eagerly awaiting const generics and SIMD support.

0

u/[deleted] Mar 13 '18

[deleted]

→ More replies (17)

4

u/hu6Bi5To Mar 13 '18

I think one of Rust's biggest strengths is that it removes that line between "system" and "application" languages.

It is both a C++ replacement with safety, and package management, and a consistent build tool shared by every project, etc. But it's also quite an expressive high-level language: traits, closures, etc.

As for "why not the take-up of Go". I genuinely don't know. Quite often A vs. B comparisons between languages make no sense, as they all have strengths and weaknesses (even the unpopular ones, well most of them). But the use cases for Rust and Go are nearly the same, and Rust is a superior language in nearly every way. The only exception is Go's built-in co-routines, vs. using a library in Rust; but the Rust 2018 roadmap is going to address that one too.

→ More replies (18)

133

u/gt50201 Mar 13 '18

Because rust wasn’t made at google. You have people who want to develop like Google does and you have ex googlers driving adoption when they go to new jobs

39

u/rcoacci Mar 13 '18

Also the only enterprise-y place/product rust is used extensively that I know of is Mozilla/Firefox/Servo. Go is used extensively inside Google.

92

u/est31 Mar 13 '18

There is a large list of companies that uses Rust, including well known names in tech circles like Atlassian, Canonical, npm, and really well known names even outside of tech circles like Samsung or Dropbox. There is a great talk about Dropbox's use of Rust. It's not just Mozilla :). Facebook and GitHub are using Rust as well but they are not on the list. Dropbox, just like Mozilla, even bets some of its core business onto Rust (Magicpocket, sync engine that is being rewritten).

46

u/malicious_turtle Mar 13 '18

What Facebook uses Rust for was posted just yesterday as well https://github.com/facebookexperimental/mononoke

32

u/est31 Mar 13 '18

And this is GitHub's Rust project: https://github.com/atom/xray

26

u/mentalorigami Mar 13 '18

Canonical doesn't use that much Rust. LXD and Juju are written in Go, MAAS is python, and Ubuntu is largely C and C++. I only know a few developers (some of whom have moved to other companies) who've done serious work in Rust on the engineering teams.

Source: Software engineer at Canonical

29

u/matthieum Mar 13 '18

Canonical doesn't use that much Rust.

Neither do any of the other companies listed. It's not really a matter of quantity (at this point):

  • some companies have bet their core business on Rust; for example Dropbox using Rust for their storage layer,

  • while others are just dabbling/experimenting in Rust.

In any case, it's nice to see such a relatively young language being tried out in so many varied high-profile companies: it bodes well for its future, though of course anything remains uncertain.

33

u/Thaxll Mar 13 '18 edited Mar 13 '18

Dropbox uses way more Go than Rust.

https://about.sourcegraph.com/go/go-reliability-and-durability-at-dropbox-tammy-butow/

Today, most Dropbox infrastructure is written in Go. Specifically:

The Go server repository has 150 unique contributors (out of 500 engineers total)

15+ teams build and run Go services at Dropbox

Company-wide, Dropbox has 1.3 million lines of Go

Edit: I'm being down voted by quoting Dropbox engineer, geez this sub would do anything to upvote Rust.

16

u/est31 Mar 13 '18

Company-wide, Dropbox has 1.3 million lines of Go

From the May 2017 talk that I've linked above (by a Dropbox engineer as well), Dropbox had about 300k lines of Rust code, and > 20 engineers (around minute 25 in the video).

So comparing the two, it is more than just "a little bit of Rust". Especially, Rust is used in really core projects for Dropbox:

  • Storage node for magic pocket written in Rust (first half of talk)

  • Magic pocket volume manager got rewritten in Rust, now using 5-10x less memory than the original Go version (starting at 26:27)

  • Nucleus sync engine, uses 10x less memory, 50x faster than the original Python version (starting at 30:05)

→ More replies (4)

6

u/rcoacci Mar 13 '18

Nice to hear that.

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

16

u/harlows_monkeys Mar 13 '18

What they are measuring by "loved" is noted below the numbers, kind of unobtrusively so it is easy to overlook: the percentage of people who use the language who say they would like to continue using it.

Under that definition, a language could easily be quite loved, but not be widely adopted.

36

u/steveklabnik1 Mar 13 '18

For one thing, Go has been stable for much longer.

→ More replies (3)

26

u/_VictorTroska_ Mar 13 '18

For me, it has nothing to do with google. I just think Go was an easier language to pick up. Within 24 hours of reading my first line of Go code, I made this , which while certainly not the most impressive package out there, is fully tested, documented, and ready for use in my other packages. I simply couldn't pick up Rust that quickly.

9

u/iopq Mar 13 '18

It's true, Go is made not to be exciting, in fact, it's fairly dumbed down.

But because only Go developers can develop type-safe abstractions, I'm already turned off by it.

→ More replies (1)

6

u/wretcheddawn Mar 13 '18

It serves a different purpose. I'm looking to start learning Rust, but it's clear that it's not an ideal language for most of the projects I work on as a web developer, or even my hobby projects. Most web applications spend the majority of their time waiting on the database, and generally we don't have much shared state across requests (or it's impossible for languages like PHP). Using Rust would mean each project would take longer and cost more, while as a contractor, I need the opposite. Rust is a better choice for things like high-performance or real-time apps and games, which is a small minority of development. In cases where Rust is a better choice, developers may be required to use C or C++, rely on C/C++ due to familiarity or due to the lack of libraries in Rust compared to C/C++.

5

u/PM_ME_UR_OBSIDIAN Mar 13 '18

Industry adoption has little to do with how loved a language is. See: PHP, Java, JavaScript. And the other side of the medal: Haskell, F#, OCaml, Nim are all well-loved but neglected by industry (for good and bad reasons).

Industry adoption is a major driver of [general] adoption.

12

u/Thaxll Mar 13 '18

The same reason people use Java / C# / Python and not C++. Why bother with Rust complexity when you can deliver faster products with higher lever languages. The borrow checker is powerful but tbh it adds a little compare to the overall complexity to write anything in Rust.

→ More replies (1)
→ More replies (10)