Posted on ::

How it all started...

I have always been fascinated by resource-efficient and performance-oriented programming languages. My journey started with C at the university in system programming courses. This is where I first learned about concurrency, synchronization primitives, memory (or more generally resource) management. It really felt empowering to have that level of control over what resources my program should use from the system it runs on.

And yet, the language itself put a lot of burden onto the developer's shoulders to:

  • Name functions of every module with a module-specific prefix to avoid name collisions.
  • Check each and every function's return value to assess if an error occurred.
  • Make sure to use valid integer types to avoid any overflow issues.
  • Make sure to get index or pointer arithmetics right in your program to avoid invalid memory access.
  • Make sure to close/free any resources that are no longer used by the program to avoid resource leaks.
  • Make sure your generic functions (void*) are called with the right types or wait for the program to maybe crash.
  • Maintain your macros and hope they generate functional code.
  • ...

One might say that with greater power comes greater responsibility and for some time I took that for granted.

Some months later, I learned C++ programming but in a pre-C++11 era so it very much felt like C-with-classes. Yet some of the problems mentioned above could already be solved by C++98:

  • Namespaces (e.g. std::) greatly reduce the risk of name collisions.
  • Exceptions offer a friendlier error handling mechanism.
  • Collections that support out-of-bound access e.g. std::vector and its at(pos) method.
  • Templates for generic and type-safe code.

But it really was when I joined BMW Car IT, some years later, that I found out about zero-cost abstractions brought to me by C++11 then C++14. Then more of the problems mentioned above could be solved:

  • Use RAII-based types e.g. std::shared_ptr to take of care of resource clean-up for you.
  • Let the compiler deduce the type of a variable typed as auto to prevent invalid conversions.

After leaving BMW Car IT, I have mostly been programming in Python with a keen interest in system programming. Python does offer nice abstractions around system primitives and allows for fast prototyping. For some parts though, it does add some overhead and hot paths in your code base can really suffer from that.

This is how I started looking into Rust.

Coming from Python and having done C++ in the past, Rust does look really familiar and combines the best of both worlds:

  • cargo gives you package/dependency management just like pip/uv.
  • crates.io gives you a package registry just like PyPI.
  • PyO3 allows you to write Rust code that integrates smoothly into your Python project.
  • Rust protects you from data races, unsafe memory operations at compile time.

How I got started...

The web is full of learning materials and those that will work best for you might depend on your learning habits. Maybe you're more of a book reader, maybe you prefer learning by doing. I fall into the latter category and this is why I picked 100 Exercises To Learn Rust. Following it along really allows you to get a practical sense of all the concepts of the language. You will learn to face and understand the compiler errors and appreciate the hints it gives you to understand how to make your programs correct.

After I had finished reading 100 Exercises to Learn Rust, I felt I still needed to practice a bit more. Just because it was around that time of the year, I decided to try out my new skills on the Advent of Code. I think it's a good way to practice around slices, Iterators, I/Os and algorithms.

To strengthen programming skills that are more rust-specific, I decided after a while to move over to exercism. Exercism offers learning tracks for 65+ languages and offers different levels of exercices from the easiest to the hardest. What's cool about it is that your solutions to the exercises are being verified by the server and you get the chance to compare them with other members' solutions. You can also get a mentor.

How I met your mother embedded Rust...

I can't remember exactly how I came across it but I nevertheless heard about The Embedded Rustacean. It's a bi-monthly digest of news targeted at embedded Rust developers. As I am both an embedded developer and a Rust enthusiast, it gave me regular good reading materials in that area.

After a while, I decided to take a turn in my Rust learning process and start learning embedded Rust by doing. And because I had already practised Rust and its standard library, I decided to take the leap and learn how to program only with Rust's core library. And that's how I ended up buying: Simplified Embedded Rust: ESP Core Library Edition. It's a great read to get started with embedded Rust and get a first embedded development experience without necessarily buying any hardware. You can indeed follow along the book while trying out the examples on the wokwi simulator. I recommend not jumping straight to the solutions but take some time to try and write your own programs first.

Where I am at now and what's next...

After all this time spent on practising, I decided I was finally ready to start working on my own project! My next post will present the project I have been working on for the past month. Stay tuned!