I’d been putting it off for over a year — though the idea of the language of intrigued me (and my friend would not stop nagging me about learning it), something in me was hesitant on starting to learn Rust:
How would I do it? How do I even learn a language like that? I have no idea how to get started on this.
These kinds of questions swarmed my head every time I thought about starting to ‘learn’ Rust. This story is a guide for people like me who:
- Are somewhat interested in ‘learning’ Rust, but have no idea where to begin.
- Don’t have that internal ‘compass’ that other people seem to possess, which guides them.
And, very crucially:
- Are afraid to skip ahead in a course for fear of ‘missing out on stuff’.
Getting Started: My Initial Approach
As I implied earlier, I had a friend who had been pushing me to learn Rust for almost a year, so, I thought to start with his recommendation — “The Book”. The Book is a nickname for the authoritative tutorial on learning Rust, it consists of 21 chapters, each focusing on a core part of the Rust language, and is available on the Rust-Lang website.
My initial approach was to simply go through, chapter-by-chapter, and learn about the language, but that quickly went awry for a number of reasons:
- By chapter 3, I was bored out of my mind — while The Book is a great reference material, it ended up being too much of a ‘learn this, learn that’ tutorial without doing much practically, which ruined it for me.
- At the same time, I was terrified of trying anything different. In my mind, trying to do anything outside the order of the chapters was going to result in my ‘missing out’ on certain concepts,
What I Was Getting Wrong
There were some fundamental things to change regarding my initial mindset:
- Individuals learn differently. In my case, I realised that simply reading the documentation and trying to abstractly understand the concepts with a few code snippets for practice was not going to work — I had started forgetting everything I knew by the second week.
- The Rust-Lang documentation itself can be read non-sequentially (scroll down), and while it would require some skipping back to cover missing things, learning things as needed would be far more engaging.
Finally, I had to accept that as part of the learning process, I would make mistakes, miss out on some concepts, and/or learn the wrong things, at least initially. Instead of agonising over that, however, I could focus on improving myself and correcting those mistakes, rather than trying to be perfect on the first try.
Trying Again: My Approach to Learning Rust (In Development)
With some help from others and internal reflection, I’ve developed a guide to help others who are similarly stuck:
Learn the basics of the language:
Chapters 1,2, 3, and 4 should be enough for this, though if you’re struggling by chapter 4, you can leave it halfway. We’ll cover it later. Simply follow along with the instructions and try out some code examples until you have an idea of how things work. Make sure to space it out, though.
Pick a project to implement:
I’ve never been good at coming up with project ideas on my own, so this isn’t the easiest for me. If you’re like me, here’s the way I tackled this hurdle (I’ll demonstrate at the end):
- Prompt Claude.ai or ChatGPT for a project to enhance your understanding. Make sure to add to the context for the prompt that you’ve completed chapters 1,2,3, and 4, and that you’re looking for something to push you to learn as well as solidify concepts.
- Whatever you get, make sure to take it one step at a time: if the entire thing looks overwhelming, read and process one-two paragraphs at a time before moving on.
- Do not worry too much about how to implement it, for now, make sure it’s something that interests/captivates you (though it’s fine if it’s not too interesting).
- Make sure to ask for the application in versions, with each version more complex.
I am not the biggest fan of basic CRUD-y apps, so I would re-prompt for a different result. Here’s the version I used when I was learning:
Implement the project. Make sure to ‘listen to your instincts’:
Here’s the fun part: take one feature from the ‘v1’ of your language and try to come up with a simple way to implement it. It’s okay to be puzzled or confused, here’s what you can do:
- Try to form some rudimentary understanding of how the feature would work. In my JSON reader, the first task was reading terminal input from the user. e.g.
cargo run -- 'query'
- Google on how to do something like this, make sure to focus on understanding ‘why’ the thing is the way it is, rather than just copy-pasting
- If you need to build a mini-project to verify something you’ve seen, that’s perfectly fine. The end goal is to gain some practical reality of the essence of the code.
- Occasionally, you’ll naturally be pulled to read a chapter of The Book. e.g, for reading from the CLI, I had to re-read the section on Strings to gain an idea on storing strings. This is perfectly fine and is even a sign that things are going well, just be sure to implement it in mini-code blocks and to not stay too long on that section — The Book makes more sense from a practical perspective (in a project).
- You probably won’t build the most efficient version of your programme on the first try. What’s more important is to keep on moving, in the future, you’ll learn better programming patterns from books, and other sources. That knowledge will make more sense after you have some context, too.
If you really hit a hard wall, you can take a go at asking a tool like Claude for some ‘pointers’. I need to stress that you only ask for general pointers/guides — AI tools can be very wrong on low-level code. In addition, much of the learning process is negated if you simply get all the code spoon-fed to you. You can, however, ask for some explanations of concepts when the documentation/source is being excessively complex.
At the end of the day, explore how to build simplified versions of things. Be sure to listen when your instincts prompt you to explore certain things, as long as it’s not too time-consuming.
As an example, when trying to understand how to extract queries like ‘key.value[0]’, I explored how Regex engines work and built a simple parser in JavaScript to parse strings (YouTube videos were particularly helpful for this) into ASTs. But, I left as soon as the course got into building a full-fledged virtual machine, as I felt that would be too much of a diversion. I could always come back to it later.
Repeat this for the next couple of sub-features, and you’ll find yourself gaining a deeper understanding of how the language works, as well as building something reasonable.
Next Steps
It’s been somewhat fun to build this, and I have learned some things about Rust. My next intent is probably to build something more complex, which forces me to cover even more of the language.
After that, it’s off to Rust In Action, a project-based book on systems programming in Rust.
Anyway, this is all from a newer Rust developer’s perspective. Let me know if this helped your learning journey.