Search this site:

Learning some Rust with Lars!

A couple of weeks ago, I read a blog post by former Debian Developer Lars Wirzenius offering a free basic (6hr) course on the Rust language to interested free software and open source software programmers.

I know Lars offers training courses in programming, and besides knowing him for ~20 years and being proud to consider us to be friends, have worked with him in a couple of projects (i.e. he is upstream for vmdb2, which I maintain in Debian and use for generating the Raspberry Pi Debian images) — He is a talented programmer, and a fun guy to be around.

I was admitted to the first cohort of students of this course (please note I’m not committing him to run free courses ever again! He has said he would consider doing so, specially to offer a different time better suited for people in Asia).

I have wanted to learn some Rust for quite some time. About a year ago, I bought a copy of The Rust Programming Language, the canonical book for learning the language, and started reading it… But lacked motivation and lost steam halfway through, and without having done even a simple real project beyond the simple book exercises.

How has this been? I have enjoyed the course. I must admit I did expect it to be more hands-on from the beginning, but Rust is such a large language and it introduces so many new, surprising concepts. Session two did have two somewhat simple hands-on challenges; by saying they were somewhat simple does not mean we didn’t have to sweat to get them to compile and work correctly!

I know we will finish this Saturday, and I’ll still be a complete newbie to Rust. I know the only real way to wrap my head around a language is to actually have a project that uses it… And I have some ideas in mind. However, I don’t really feel confident to approach an already existing project and start meddling with it, trying to contribute.

What does Rust have that makes it so different? Bufff… Variable ownership (borrow checking) and values’ lifetimes are the most obvious salient idea, but they are relatively simple, as you just cannot forget about them. But understanding (and adopting) idiomatic constructs such as the pervasive use of enums, understanding that errors always have to be catered for by using expect() and Result<T,E>… It will take some time to be at ease developing in it, if I ever reach that stage!

Oh, FWIW — Interested related reading. I am halfway through an interesting article, published in March in the Communications of the ACM magazine, titled «Here We Go Again: Why Is It Difficult for Developers to Learn Another Programming Language?», that presents an interesting point we don’t always consider: If I’m a proficient programmer in the X programming language and want to use the Y programming language, learning it… Should be easier for me than for the casual bystander, or not? After all, I already have a background in programming! But it happens that mental constructs we build for a given language might hamper our learning of a very different one. This article presents three interesting research questions:

  1. Does cross-language interference occur?
  2. How do experienced programmers learn new languages?
  3. What do experienced programmers find confusing in new languages?

I’m far from reaching the conclusions, but so far, it’s been a most interesting read.

Anyway, to wrap up — Thanks Lars! I am learning (although at a pace that is not magically quick… But I am aware of the steep learning curve of the language) quite a bit of a very interesting topic, and I’m also enjoying the time I spend in front of my computer on Saturday.