Ricardo Tavares

May 14, 2023

Why I'm (still) learning Rust

Disclaimer: People in the Rust Foundation would like you to know that, although the title of this article contains the word Rust, its author is not a part of the Rust Foundation (trademark policy draft available here). I understand how this might sound confusing, but don't let it discourage you from learning more about this language.

Although you may know that learning new programming languages makes you a better overall programmer, that is usually not enough to continuously push you out of your comfort zone. Personally for me, as I have a love for web development in particular, at first I didn't pay much to a language that only seemed to be a modern version of C. But that description doesn't do justice to Rust, as it seems to be offering more and more avenues that align with people's interests while keeping to its safety-first philosophy. Namely, it's important for me to keep an eye on WebAssembly, which Rust can compile to, but I will start with a few reasons that have pulled me into this language that are not inherent to Rust itself.

🌍 The first one is similar to what has happened with projects like React or Tailwind. No matter what you think of it, smart people have gathered around this thing and are building a lot of cool stuff for it. This includes tooling, documentation, learning resources, and libraries, reference points that become a helpful standard for beginners. And unlike the Javascript ecosystem, Rust standards are solid. The official resources to learn Rust are a strong starting point and cargo is the only package manager you need.

🌍 Another reason that doesn't have to do with the language itself is the aspirational drive of its stewards. Even with the issues related to the disclaimer you see above this article, I can understand the need to guide a brand and its communities in an effort to make them sustainable and inclusive of new people. It's refreshing and even laudable to have some vision for the future that isn't purely technical.  "A language for the next 40 years" that aims to empower everyone.

🌍 Finally, new GPT tools like phind.com have changed the way we can approach difficult subjects by allowing us to ask all the stupid questions we need to unblock whatever project we've gotten ourselves into. Unlike search and how it mostly reflects your ignorance back at you, conversational AI tries to predict what we want to know while we're still learning what are the correct words for our question. In particular, this allowed me to complete my first learning project after reading only the first chapters of the official book, which is often my favorite learning style.   

Given that first impression, what are the features of the language itself that have maintained my interest so far? I've worked through the first ten chapters of the official book and I built wpskim, a real CLI tool that I can use to scrape information from WordPress blogs. My perspective is from a person that dabbles in computer languages, but works mainly with PHP and Javascript. My experience with C has only been in an academic setting and I've had no interest in coming back to it. The deeper problems that Rust addresses with memory management for me are mostly a theoretical issue. And static typing is something that can frustrate me when the only thing we get out of it is a better linter (looking at you Typescript). 

🦀 Therefore, good error messages are for me a very nice plus. It's true that you never get the feeling of flying through code and instead you feel like coding Rust is a constant negotiation with its compiler. But usually this is a learning experience, messages are helpful and, at the very least, teach you what to ask the GTPs about.  

🦀 Getting to the finish line of a project is also something I enjoyed in particular. Once you've gotten through the compiler and maybe have written some tests, you're mostly done. Build the thing for release and you can run it just like any other CLI tool. And performance is good, even without thinking much about it.

🦀 The C comparison doesn't have a lot to go on. Rust has a lot of convenient methods that are just there for human beings who just want to do the thing. Vectors, for example, have a contains or a sort method. Error handling is mandatory, but you're given a lot of options to address unexpected states. 

All of this and I still have a lot to explore, like the Tokio async runtime or Leptos reactive web apps. I'm curious to see how web development will have a Rust story (although we can say that it already has). And if you're still on the fence about Rust, my only advice is that you take your time with it. Each step forward is a rewarding puzzle and I believe that everyone may have something to learn from Rust.    

About Ricardo Tavares

Creates things with computers to understand what problems they can solve. Passionate for an open web that anyone can contribute to. Works in domains where content is king and assumptions are validated quickly.

Mastodon  |  Twitter  |  GitHub


View From the Web