Learning Rust - Front End Developer’s Perspective
Rust has been named one of the most loved technologies by software developers in recent years, not without a reason. It is fast, well designed, and a well documented programming language, providing great developer experience. It gained support among many coders, especially those working with similar but older technologies like C or C++. Could it be worth learning for a front end developer? And, if so, why?
Well, for a couple of reasons.
Front End Tooling
Rust is here. The more front end developers will use newer and faster tools built with it, the more they may need to interact with the language these tools were written in. It might be simply useful to know Rust, at least on the basic level.
Front End Applications
Web Assembly opened the door to the web for compiled, low-level languages. Some popular apps like Photoshop or AutoCAD are available to use in the browser today. More and more products are being created with the web platform in mind.
That’s why, for me, Rust stands out. I’ve been working with complicated frontend projects that used different bundlers, linters, and formatters altogether, and there were many cases where conflicting module types, conventions, etc. were preventing me from completing simple tasks quickly.
Rust seems to be designed in a very thoughtful manner. There is a main tool you should use: Cargo. It’s a build tool and a package manager. It also provides linting and formatting mechanisms. And, it has a
clippy command that can teach you some useful things.
This consolidation makes work much easier and doesn’t throw you into neverending debates about the superiority of one tool over another.
How to learn?
That said, you may ask: where to start?
Number type. Strings are “just” strings, etc. Rust’s learning curve might become even more steep, then!
But don’t worry, with proper strategy, you can do it. Here’s a list of 10 things that helped me to jump from a total noob to quite a fluent beginner.
- Focus on the basics. Read the book “Rust Programming Language” by Steve Klabnik and Carol Nichols. Carefully study the first six chapters covering data types, functions, control flow, ownership, structs, and pattern matching.
- Try to write simple programs (the book encourages you to do so). You can try the Rustlings course, or any other course on the Internet. And when confused, check Rust by Example. Or ask Chat GPT. AI can be a great learning partner.
- Take breaks if your brain can’t take in more. Time off is crucial for organizing newly acquired knowledge.
- Don’t copy-paste, write code on your own. It will help you memorize keywords and become familiar with the language.
- Learn to read the docs. For me, getting to know traits helped a lot with understanding the structure of any library’s documentation. There is also a Rust Doc Book covering the topic. And again, AI assistants like Chat GPT can help you digest the documentation and get desired information.
- Find a field you’re interested in. Maybe you already have one. Try to write a program that does “your thing” or rewrite the one you already have in Rust. It will bring more battlefield knowledge to your arsenal! For me, such a thing was doing generative art to be drawn with a pen plotter.
- Contribute to open source projects, when you feel confident enough. From my experience, the Rust community is cheerful and welcoming. Helping with open source will bring experience of solving real world problems. Vsvg library was my starting point.
- Focus on the basics. Again. Yes, you read that correctly! In an era of short attention spans we tend to skip parts of the content that may seem uninteresting or not needed. This is error prone, therefore it’s good to iterate and revisit parts of the content you’ve consumed once upon a time.
This was my case. After a few months, I came back to the chapter about ownership and borrowing. It made me realize that my knowledge was lacking some key parts. Re-reading it was insightful, and let me better understand the program I wrote a few days earlier, which brings us to the next part.
- Review your work. Apply regained knowledge. Rediscovered information might improve your code, where you would not even expect.
- Use Clippy. I mentioned it a few paragraphs above, but I want to highlight it. Clippy is a unique feature of Cargo, “a collection of lints to catch common mistakes and improve your Rust code”. It will become one of your best friends on the way.
The list could be longer, probably. You can shape it in a way that fits you the most. There are tons of programming learning resources, but when you start, it might be clever to stick close to the source.
But whatever way you will go, I keep my fingers crossed for your learning process and I hope you’ll have as much fun with it as I do!
For more awesome Rust-based, front end related things, check the following links:
- Awesome JS Tooling in Rust
- Awesome Rust
- Awesome Rust and Web Assembly
- Rust front end framework comparison
Techreviewed by: Marcin Baraniecki, Tomasz Krawczyk, Krzysztof Grajek