Special Planning Study Tips Series 2 Listen to What the Class Representatives Have to Say

Special Planning Learning Tips (Part 2): Hear What the Class Representatives Have to Say #

Hello, I am Ye Qian, the editor of the Rust course. Today, we have the second edition of class representatives sharing their personal learning experiences.

New students have always been puzzled about how to learn better: Why do I get more confused the more I watch the first six lectures? What knowledge background do I need to learn Rust and this column? There is a need for a manual for this column or some organization of relevant background knowledge…

To help you learn better in the new year, I specifically invited several class representatives to share their experiences and methods in learning the column and the Rust language, hoping to provide some reference and inspiration for you. Enjoy your learning.


@Marvichov #

Hello, I’m Marvichov, a software engineer with 5 years of experience. My current field of work is distributed machine learning, and my main programming language is Python. I also have work experience with C++, having spent two and a half years on search engines and another year and a half on open-source projects. I also use Java and Go for personal project development and learning.

Like most people, I set a goal to complete this course, but I stopped at async.

When learning a language, you first need to understand why you want to learn it. There are thousands of languages in the world; isn’t learning English also appealing? For me, the reason to learn Rust is simple: Rust’s safety model is very interesting and genuinely solves many of the pain points of C/C++. For low-level development, safety is becoming increasingly important, with a higher priority than performance.

Here’s an example from a colleague: Ever since switching from C to Rust, he can sleep peacefully at night. He is no longer woken up by sudden Segfaults in the middle of the night. Some multithreading bugs are normal to debug for a month. Now, he can confidently merge PRs from newbies, as the compiler blocks the code with potential safety hazards.

If everything goes as expected, Rust will dominate the low-level domain in the future. If you want to do low-level development, you cannot avoid this essential challenge.

When I first started learning, I read the official the book, which gave me a preliminary, intuitive understanding of Rust. However, The book is quite superficial and stops short of deep dives into various knowledge points. Especially for critical topics like lifetime and borrow checking, the book does not go in-depth, leaving me still in the dark about how the compiler calculates lifetime. For more in-depth learning, the nomicon and the official reference are still required.

Later, I encountered Non-Lexical Lifetime (NLL) and dived into compiler implementation details. I increasingly realized I was out of my depth, getting caught up in language syntax. I spent a lot of time studying the language itself instead of accumulating practical project experience.

This is similar to my experience learning C++: getting caught up in various syntactic features, wasting a lot of time memorizing syntax that isn’t useful in practice. Ultimately, I still learned C++ by constantly doing projects at work. Moreover, most syntax features are not used in practice. Spending a lot of time in theory did not equate to learning but to self-gratification.

Therefore, I still prefer to get hands-on quickly when learning a language, jumping directly into projects. Many experts learn new languages by rewriting projects they are familiar with in the new language.

I remember Uncle Hao sharing in his “Listening to the Wind” column how he learns languages by focusing on memory management, error handling, type systems, etc., and then spends a day or two writing a small project to master a new language. Languages are largely similar, and after learning a few, one can quickly draw parallels. However, I do not have any end-to-end project experience, making this method quite challenging for me.

However, for most people, including myself, there is a quick way to get familiar with a language, which is to do coding exercises, rewriting algorithms they’ve encountered before in Rust.

Leetcode’s support for Rust is mediocre at best, and there are no stack traces when errors occur. I personally chose exercism, where all the code and tests can be run locally, facilitating debugging. Many Rust engineers around me got up to speed with Rust by doing exercises and were then assigned to rewrite some Java projects. You might consider this method as well.

Fortunately, Chen Tian’s Rust column provides many hands-on small projects, compensating for the shortcomings of various Rust books on the market and avoiding the pitfall of stopping at the language itself. After all, languages are meant to solve practical problems. We learn Rust not to show off but to create value with programs.

Actually, I hesitated about whether I should buy the course because the grammar knowledge points are already very detailed in the official book and the nomicon. But when I saw the hands-on project in the sixth lecture, I did not hesitate to order right away. I am very interested in compilers and can handcraft an SQL parser. If I can use Rust, wouldn’t it be perfect to kill two birds with one stone?

How I Study the Column #

I’ll also share how I studied this course, hoping to provide some reference for you.

  • Lectures 1-3 Memory Preliminaries

If you want to understand how memory is managed or delve deeply into a program’s address space, I recommend taking “Computer Systems: A Programmer’s Perspective” (CSAPP). Professor Dave of this course said, “If you take only one foundational computer system course in your life, CSAPP is enough.” I later supplemented this course, and it indeed helped me understand many underlying system principles.

In short, at the machine code or assembly level, there is no concept of ownership or lifetime, just data and a series of instructions. The CPU only knows about executing instructions, data transfer, reading and writing various registers, as well as memory, such as the stack and heap from the programmer’s perspective.

Ownership and lifetime are high-level language abstractions, part of the Rust language, and not part of the eventual machine code run by the computer. Like the loop invariant in algorithms, the restrictions on language syntax ensure the compiled code will not have errors that jeopardize memory safety at runtime.

  • Lectures 4-6 Get Hands Dirty

When I first studied, I quickly went through it without seeking to fully understand the syntax details. It’s good enough to know that Rust is flexible for project writing and supports many domains. These lectures are information-heavy and can easily discourage newbies, so I left it there if I couldn’t understand something and would come back to it later.

  • Lectures 7-14 Ownership & Containers

Fundamental of fundamentals. First, understand ownership and lifetime, which are the core issues Rust aims to solve compared to C: memory safety. I typed out the examples in these courses line by line by myself. First, go through the examples and then write them once. After all, according to the Learning Pyramid, the effect of learning by doing is 50% stronger than just reading. Afterward, understand smart pointers and various basic data structures to get started on projects or coding exercises faster.

  • Lecture 18 Error Handling

The highlight within the highlights, and also an example of Rust absorbing the strengths of other languages. The built-in syntactic support distinguishes Rust from other mainstream languages like C/C++ and Java. The error handling approach also reflects Rust’s safety design philosophy.

  • Lectures 12-14, 23-25 Traits

Traits are one of the cores of Rust and the foundation of Rust’s abstractions. Familiarity with the abstract style of interface-oriented programming is essential to keep up with the various projects in the course. Many Traits must be mastered, such as AsRef, From, Deref, Drop, Send/Sync, etc. These Traits are like the basic elements of building the Rust world. If you are not familiar with them, it is tough to read documentation and design interfaces.

  • Lectures 21-22, 26, 36-37, 41-42 KV Server Hands-On Series

This series can be put aside for the first run and is better learned in conjunction once all the Rust knowledge points have been gathered. The course is arranged to intersperse learning about the KV server, constantly adding new knowledge points, and iterating on the project with new syntactic sugar. However, the project’s code is not minor, and it is easy to forget various details and contexts midway. When I learned, I felt that learning this project intensively, striking while the iron is hot, was more effective.

  • Other Lectures

The rest is mostly project practice, mainly familiarizing with various I/O and interfaces, system design. Apart from following the teacher’s steps to type out the code, I can’t think of a better way. The teacher has a wealth of project experience, and I need to ponder many designs for a long time to understand them. The later I learn, the harder it is to keep up with the teacher because I have to learn both the teacher’s design ideas and various Rust knowledge points. All I can say is that one course counts as two courses, which is very cost-effective.

My Learning Method #

The first method is to draw mind maps; a picture is worth a thousand words. Internalizing the knowledge points learned in one’s language is necessary. The teacher is a great role model in this respect, starting each lecture with a knowledge map.

The second method is to build your own knowledge system. The core idea is holistic learning. Each knowledge point you learn is an island; connecting them allows you to draw parallels and make it difficult to forget what you have learned.

For example, if the knowledge points are not connected, they become isolated islands, which are easily forgotten. When the connections between the knowledge points increase, isolated islands become cities. When you get lost in a city, you can easily navigate to your destination. But if you’re lost in the wilderness, you will need to pay a significant price to reach your destination. Much of the time, this means starting over with your studies.

When learning Rust, I like to compare it with C, C++, and Golang, connecting similar knowledge points.

Take an example, templates and RAII in CPP correspond to generics and Drop in Rust; Golang’s interface is similar to Rust’s trait, both related to interface oriented programming. Rust’s only difference from other languages is its safety model. Therefore, when learning, we can focus on mastering ownership, lifetime, and thread safety.

The third point is to be hands-on. I personally think that coding is 99% skilled work, and there are no shortcuts or need for talent. High school-level mathematics and logic are sufficient. In the industry, only 1% of people can do mathematical programming, creating, researching, optimizing, and writing core algorithms. Becoming one of these 1% requires talking about talent.

Rust is difficult not because coders lack talent but because it demands coders have a solid foundation in lower-level concepts and a good understanding of the memory model. If you hit a bottleneck learning Rust and can’t continue, consider stepping back and reinforcing your foundations. Here I recommend CSAPP again.

The fourth point I mentioned before is that in addition to following the teacher’s projects, you can also do coding exercises. When checking exercise answers, I noticed many students like to turn complex logic into a single line through functional programming. This is like those one-liner Python enthusiasts showing off that they can complete a task with one line. It’s okay to do this in Python because no one expects Python code to perform well. Not so much in Rust.

Although Rust is highly expressive and encourages functional programming, it is still a low-level language. The most important characteristics of a low-level language are readability and optimizability. When you compress a complex program into one line or one statement, it’s hard to see where optimization is needed. Some Rust engineers around me also told me no one writes code like that in practice. Most of the time, they use the simplest and most straightforward APIs, clear generics, and the design philosophy of interface-oriented programming.

The last point is to debrief.

On a small scale, it means prompt review. Harping on the Ebbinghaus forgetting curve from middle school, according to this rough model, you forget 70% in one day. In a week, it’s 77%. People are busy in society now, so it is good to find time to review within a week. Otherwise, if you learn and forget, you will only ease your anxiety and impress yourself.

Here I recommend the method shared by the master Jon Gjengset: during class, he doesn’t take notes but listens attentively, aiming to understand everything during the lesson; after class, he uses the Cornell note-taking system for review. This note-taking method is specially designed for review and fighting forgetfulness. It’s effective. Many note-taking software have built-in Cornell note-taking templates.

On a larger scale, it means establishing a knowledge system and methodology. After class, summarize what you’ve learned. By following the holistic learning approach mentioned earlier, connect what you’ve just learned with what you’ve learned before and also review previous knowledge.

Apart from debriefing knowledge points, you can also debrief whether your learning method is effective and whether your study plan is well-arranged. Debriefing is a very disciplined process, and I am also constantly exploring it. I hope to progress with you in 2022 and continue to grow.

Learning Materials #


This is today’s sharing from class representative Marvichov. If you have your own Rust learning story, feel free to leave a message in the comments below to exchange and learn with each other, reflect with each other, and progress together.

See you in the third edition!