DEV Community

Cover image for WTF is Rust? The Illustrated Notes
Maggie Appleton for egghead.io

Posted on

WTF is Rust? The Illustrated Notes

The Rust programming language keeps winning the middle-school popularity contest of the developer world: "most loved" on Stack Overflow surveys.

stackoverflow

So, what's this Rust thing and why is everyone enamoured?

Let's explore...

WTFRust_1

WTFRust_2

WTFRust_4

This happy balance Rust manages to strike – between speed, control over memory, and human-friendliness is what makes it so popular.

The kind of programmes you can write with Rust would otherwise be made in a language like C or C++. A lot of developers find the C-suite challenging to work with, so this friendly alternative is very welcome!

It's got the Goldilocks Effect going on. Not too slow, not too dangerous, not too complicated – just right.


The Rust community is also infamous for being welcoming, open, and encouaging to newcomers. Fostering that kind of culture is very likely why it's gained so much traction in the last few years.

Anyone who hangs out in Developer World long enough realises frameworks and languages are identities much more than they're tools. You belong to Team React, or Camp Python, or the Rust Crew.

And no one wants to join a bunch of judgey gatekeepers.

WTFRust_5

WTFRust_3

WTFRust_6


I've just done a sweeping and completely incomplete overview of Rust here. But it's enough to point you in the right direction.

While researching and making these I watched Pascal Precht's egghead course that shows you how to Write Your First Rust Programme

write-your-first-program-with-the-rust-language

It's free 20 minute course that shows you all the basics.


👁‍🗨 If these are hard to read, you can download a free high-res PDF version on the course itself.
Dev.to limits image sizes a lot and it's hard to make it readable on here. Apologies!

Top comments (4)

Collapse
 
nicholassterling profile image
Nicholas Sterling

Love the very nicely done graphics! Reminds me of the Head First books.

I agree with Andrey about the comparison with JS and C++. Rather than being

JS . . . . . . . . Rust . . . . . . . . C++

I see it more as a two-axis thing:

JS . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . Rust
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . C++

Where the horizontal axis is speed/low-levelness and the vertical axis is ergonomics. Even that leaves out safety and the quality of the type system, but you can't fit everything into one diagram. :)

In any case, please keep it up -- good stuff!

Collapse
 
cryptoquick profile image
Distributed Hunter Trujillo

Agreed. It's not the "middle ground" so much as, the best of both worlds. I also like your chart because it's not as ergonomically superior as JS, as in, people coming from carefully manicured JS and TS codebases might find writing programs in it, and reading Rust code somewhat jarring, but not THAT jarring, and many of the idioms carry over nearly 1-to-1.

C++, OTOH... arguably, Rust is just as fast, if not faster, than many C++ programs, and it certainly builds MUCH faster.

Also, in terms of utility, Rust is growing into every conceivable place it can be shoehorned, similar to how JS became with NodeJS, Electron, and React Native, but... It's actually more comprehensive, and performance-oriented. Applications built in Lucet, Krustlet, and WASI are a little far off, but not that far off, and the promise is huge. Furthermore, projects like Iced have the potential to replace what Electron does for web apps, with no need to change frameworks. It would be similar to Flutter, in that, it's a frontend framework, but builds for multiple platforms, i.e., web and desktop native. Further, people are experimenting with Rust on mobile devices, such as Cargo-Mobile, with native ARM instructions (aarch64 target). This is all a testament to the versatility and benefit we're starting to see from Rust, and while not fully mature, it's much better than it was even a year ago, and two years ago, it's night and day.

Collapse
 
cryptoquick profile image
Distributed Hunter Trujillo

One more thing; the toolchain is comprehensive, built-in, and on the vast majority of projects, fully utilized; unit tests and benchmarks are often written in the same file, along with automatically-generated documentation that is not just useful, but centrally-located for all projects (docs.rs). Rustfmt is extensively used to the point where, any open source contribution will be formatted the same way. It would be as if NPM came with Jest, Prettier, TypeScript, and Webpack all built-in, (AND, critically, all projects actually used them), and it could compile to tiny (by comparison) platform-native targets relatively quickly (though not as quickly as Go). Oh, and if the docs don't do it for you, most projects also come with a pretty comprehensive set of examples. Oh, and the community is weird and wonderful and diverse and awesome and helpful and active and energetic, so, that also helps. They're also not terribly dogmatic, other than, Rust is awesome, and it should be used everywhere. The critical thing is, most people don't really specify "how", since Rust is relatively easy to refactor compared with most other languages, and there's no one way to write amazing Rust.

Collapse
 
avkonst profile image
Andrey

I disagree a little bit with happy middle ground between JS and C/C++. I would say it is nearly on the level of C/C++ when we talk about performance. And I would say it is very close to the level of JS when we are talking about "high-level" abstracts. But not in the middle in both categories. Although I understand what you tried to say by this diagram, I can see it can make a false / incomplete impression.