Teaching Rust at the University of Warsaw

436 points agluszak

Hi! For the past two semesters I've been working as a Teaching Assistant at the University of Warsaw (Poland). I've been teaching Memory Management & Programming in C (1st year) and Concurrent & Parallel Programming in Java & C (2nd year). Now the faculty has decided to start a Rust course for 2nd year students and I've been entrusted with the task of preparing the course and conducting classes.

I would like to ask fellow Rustaceans for advice. How does your dream Rust university class look like? :)

Context:The course will consist of \13 1.5h weekly meetings (combined lecture & lab). There will be 2 groups with \15 students taking part (this is not a mandatory course, it can be selected from a list). Students will have an excellent knowledge of Java, C and C++ (including its most recent features like concepts), concurrent programming and algorithms and data structures. During that semester they will have courses teaching network communication and Web apps, so I could incorporate that knowledge towards the end of the semester.

My current plan looks more or less like this:

  • The Book will serve as a base. During each meeting we will cover a few chapters from it. I will be preparing slides providing condensed knowledge from The Book, but students will be encouraged to read it in full :)

  • We will start by setting up the environment and talking about the ecosystem and good practices entailed by it: rustfmt, clippy, rust-analyzer/IntelliJ-Rust.

  • Covering The Book should take \~9 meetings. After that the topic will be async in Rust. We will talk about async theory itself and then walk through the Tokio tutorial.

  • During the last few meetings we will review the most popular crates for various use cases: rayon, anyhow, serde, clap, bevy, iced. Some of them may get covered earlier if need be.

  • Emphasis will be put on comparing Rust's features to analogous ones from the languages students already know: Option vs null, Result vs exceptions, borrow checking vs malloc/free, Rust's smart pointers vs C++'s smart pointers, async in Rust vs CompletableFutures in Java etc.

  • Grading:

    • There will be 5 small-ish tasks - students will be given \~10 days to complete each (not because the tasks are so hard, but because they have a lot of tasks from other courses, so the deadline can't be shorter).
    1. a CLI greeter program - asks for user's name, if it's saved in its "database" it greets the user, otherwise requires user to introduce themselves. Something akin to Herbert Wolverson's treehouse program from Hands-on Rust :) This will be students' first 1. fight with the borrow checker, they will need to understand the difference between Vec<T> and &\[T\] and String vs &str.
    2. a task based on something from this year's AoC, probably https://adventofcode.com/2021/day/12 (implementing A\*).
    3. a modified version of the pseudo-grep project from The Book (https://doc.rust-lang.org/stable/book/ch12-00-an-io-project.html).
    4. an expanded web server project from The Book (https://doc.rust-lang.org/stable/book/ch20-00-final-project-a-web-server.html).
    5. something to pertaining to Tokio.
    • There will be a two-part medium-sized project designed from scratch. Students will be able to choose a topic, for example: a simple game (chess - simple implementation-wise of course ;), space invaders, flappy bird etc.), a bare-bones network chat application or an uncomplicated image editor. The first part could be feature a TUI and the second part would require to write a GUI, or create an async version with the same features.
    • The final project will be a contribution to a real-world open-source project :) There's a plenty of entry-level issues so I'm sure that everyone will find something suiting their skills and interests. The contribution doesn't need to be big at all, I think I will be satisfied with anything the repo maintainers would be satisfied with - a fixed bug or a tiny feature. One requirement: the contribution needs to include writing unit tests.

I'd be glad for your feedback. Hopefully this will turn out to be a fun and worthwhile course and students will taste the pleasure of programming in Rust and get to know how welcoming the Rust community is!

P.S. I'm a recent graduate myself ;)