Five Reasons Why You Should Learn Rust

Agoda Engineering
Agoda Engineering & Design
3 min readOct 31, 2022

by Idan Zalzberg

The Rust programming language has gained amazing popularity in recent years, and we are seeing it more in areas like Crypto, WebAssembly, and, recently, the Linux kernel.

While Rust is not the best tool for everything, I would encourage developers to learn the language and become familiar with it. Here are a few reasons why.

A truly novel idea

Rust’s ownership model is genuinely a new and refreshing concept for me. Rust guarantees memory safety without garbage collectors or automatic reference counting. This novel idea is exciting and interesting to learn; furthermore, Rust expands that idea into thread safety. After 20 years of professional software development, you don’t get your mind blown as often, but Rust did the trick for me. :)

All the right decisions

Rust is extremely well designed — separation of data (structs) and logic (implementations); generics are done right with the ability to add implementations of functions only for specific generic variants. The richness of the Iterator trait brings in all the goodies of stream processing with one implemented function but without any of the performance guilt (thanks to zero-cost abstractions).

Last but not least, a beautiful approach to error handling forces you to deal with your errors explicitly but is also concise (with no null values!).

The compiler

Even though the language is not easy, the compiler is your best friend, your mentor. Not only will it tell you exactly what the problem is, but in many cases, it will suggest the correct solution. So, in a way, it’s a private teacher for free that helps you understand your code and how to improve it further :-)

Closer to the metal

High-level languages often abstract things like “how many bytes is an integer” or “is this going to be allocated on a heap or stack?” Rust puts these decisions in your hand and makes you accountable for every clock tick of the CPU.

Going back to concepts like that reminded me how insanely powerful the hardware of computing is these days and how much we can get out of even one CPU core when we put effort into utilizing it properly. It helps that the community is obsessive about performance as a whole, and you can learn a lot just from reading the code and documentation of other crates you are using.

It makes you a better developer

Using Rust for a while changes how you look at writing software. You go back to wondering, “what the CPU actually does when I write this.” And you can take these learnings with you to other languages. Going back to a JVM language, I now think about every “new” operator usage because I realize it creates an allocation on the heap (that would need to be cleared up later) and consider if it is really required. And to be honest, it’s a real challenge. It’s a new mental model and can take some time to learn, and just challenging yourself and “exercising” your mind is always a good practice, in my opinion.

Idan Zalzberg is the Chief Technology Officer of Agoda

--

--

Agoda Engineering
Agoda Engineering & Design

Learn more about how we build products at Agoda and what is being done under the hood to provide users with a seamless experience at agoda.com.