<--

 

2020-10-14

Rust in 2021 - Rust for JavaScript developers

This post is a response to the Rust core team’s call for blogs. I'm a little late for the official deadline, but this post isn't so much about what I think should be in the 2021 edition of Rust as much as it's about reiterating my thoughts from 2019. Specifically, I think the focus for 2021 should be to continue making learning Rust easier and more accessible for non-systems programmers.

Back in November of 2019 (a lifetime ago, it seems), I wrote up some thoughts on some possible goals for Rust in 2020. The TL;DR of that post: we need more learning resources for newcomers to Rust, specifically resources that aren't the standard long-form writing like books and articles. I think Rust has made some fantastic strides towards this goal this year (and really, it will always be a moving goalpost -- we can always continue to improve), with a plethora of new and exciting projects that serve different groups of newcomers trying to learn the language.

I care about this goal because, back in 2017 when I first started trying to learn Rust, I didn't feel like there were a ton of resources that were made for me. And by me, I mean a web developer with no formal CS background and no real experience doing systems work. Back then the official Rust website supported that sentiment, with the stated goal that: Rust is a systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety. I didn't even really know what a segfault was, and I certainly couldn't tell you what a safe thread looked like. But a few things kept me interested, beyond sheer stubbornness and the words blazing fast.

First off, I'd already all but given up on learning C or C++. After struggling through several different learning resources, I was basically told straight up that with my background, it would be 3-5 years before I was done continuously shooting myself in the foot with C, and could then maybe call myself a novice. C++ looked to be a similar timeline, just to figure out how to write good, clean, modern code without again shooting myself innumerable times in the foot. Coming from JavaScript, I felt like there was too much that I didn't know I didn't know, and I couldn't figure out a good path out of the dark on my own. At that point, Rust seemed like it could be an alternative, even if it was just people on HackerNews who said so.

Another thing, somewhat related to the first, was that I truly didn't feel like a Real Programmer, having spent most of my professional time to that point working with JavaScript and PHP. This sentiment also probably had a lot to do with how often I was on the orange site, but at the time it was something I felt pretty strongly. Languages like Rust and C and C++ felt like doorways into a new world, with crazy things like compilers and pointers and memory and other dangers waiting on the other side, if I could just figure out how to get through.

And for these reasons, at least initially, I kept trying to learn Rust. I bought all 4 books available for sale at the time. I worked through the blog posts and series from others who were kind and industrious enough to publish them. I wrote some (very, very bad) compilers. I learned what a pointer is. But it hasn't been an easy process, and it hasn't been continuous either. I've gotten frustrated and quit more than once in the past 3 years, and those niggling thoughts about not being a good enough programmer were hard to shake at times. Even now, 3 years down the road (ironic, huh?), I still feel pretty novice in some areas, although looking back I can see really just how much I've learned from the process.

All of this to say, I don't think I'm the only JavaScript developer who has tried to learn Rust and struggled with it in the past three years. According to last year's survey, the second most common response to the question "Why not Rust" had to do with the learning curve. Of those respondents, the vast majority were web application developers (read: JavaScript, PHP, Ruby, etc. developrs). Of those who've tried to get over that learning curve, I think many of them were eventually turned away by the lack of diverse learning resources. And like I said before, as bad as 2020 has been for everything else, I think it's been a pretty great year for new Rust educational content. But, we can do better. And I hope we do better in 2021.

And by we, I really do mean we; they say you should build things that solve your own problems. So, I'm putting together a series of screencasts, exercises, and other resources aimed at teaching Rust to JavaScript developers. It's still pretty early on, but I hope to have some parts of it ready soon, with the whole project done sometime in January of 2021. If this is something you think would be awesome to have, just shoot me an email at tindleaj@gmail.com and I'll keep you updated.