Exploring Rust in a Professional Setting: A C++ Engineer’s Perspective
Richard Zampieri
Posted on August 7, 2024
With over 23 years of experience as a C++ engineer, I’ve seen a lot of programming languages and technologies evolve. I’ve always been eager to explore new tools, and recently, I decided to dive into Rust. My current role as a Principal Engineer at a tech company gave me the perfect opportunity to try Rust in a real-world, professional setting.
The Project: System B Communication Layer
We recently started developing a robotics system, and I was tasked with building the architecture for communication between the system A and the system B. This involved creating a layer that interfaces with the System B using ROS2 and delivers messages to a desktop application.
For this layer’s API, I decided to give Rust a try. I bought a book, went through the entire tutorial, and got up to speed fairly quickly. For the UI, I chose Tauri as the framework for the desktop application, using Vue for the front-end.
First Impressions: A New Development Pattern
Rust’s programming paradigm is quite different from what I was used to with C++. If you come into Rust with an OOP mindset, you’re likely to struggle at first. Rust encourages a different way of thinking about memory management, ownership, and concurrency.
One of the biggest challenges I faced was dealing with the compiler. Rust’s compiler is notoriously strict, and you’ll spend a lot of time wrestling with it until you understand how it works. However, this is also one of Rust’s strengths. The compiler forces you to write safe, reliable code, which leads to fewer runtime errors.
The Crate Ecosystem: A Mixed Bag
Rust has a vast ecosystem of crates (libraries), which can be both a blessing and a curse. On one hand, there are millions of crates available for almost anything you can think of. On the other hand, many of these crates are low quality, and it can be challenging to find the ones that are truly useful.
If you’re serious about using Rust in a professional setting, you’ll need to be selective about the crates you rely on. The good news is that once you find the right tools, Rust’s ecosystem can be incredibly powerful.
The Turning Point: Embracing Rust’s Philosophy
After a while, I started to get the hang of Rust’s philosophy. I stopped fighting with the compiler and began to enjoy the coding process. One thing that really stood out to me was how reliable my code became. In C++, I’m used to dealing with warnings and errors during compilation, but with Rust, my code compiled cleanly and just worked.
The sense of security that comes from knowing your code is stable and reliable is one of Rust’s biggest advantages. It’s not something you often experience with C++.
Rust in Production: A Balanced View
In my experience, Rust is absolutely production-ready. It’s a joy to work with, and the language’s emphasis on safety and reliability is a huge plus. However, the ecosystem still has some catching up to do. I found myself building a lot of tooling and writing my own libraries to fill in the gaps for my specific project.
If you’re considering Rust for a professional project, be prepared to invest some time in building out your own tools and libraries. The language itself is fantastic, but you may need to do some extra work to get everything you need.
Final Thoughts: A Positive Outlook
Rust has a lot to offer, especially for developers who value safety, performance, and reliability. While the ecosystem is still maturing, the language itself is rock solid and ready for prime time. If you’re up for the challenge, Rust can be a rewarding addition to your toolkit.
In conclusion, Rust is a joy to program in, even if it requires some adjustment and a bit of extra effort. As the ecosystem continues to grow, I’m confident that Rust will become an increasingly popular choice for professional development. It’s already proven itself in my experience, and I’m excited to see where it goes from here.
Posted on August 7, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.