The programming world: why hasn’t Rust gone rusty?

CodiLime
CodiLime
Published in
7 min readJul 11, 2022
Rust programming language

Programming languages come and go. They are brought to life, create hype, then, suddenly vanish away. However, some of them address pain points that exist in various other languages, providing a solid step forward with no (or almost no) cons. One such example is Rust, a programming language that has won the hearts of thousands of developers all over the world. Stack Overflow has considered it the most beloved language for the last four years. Why? What’s the deal with Rust? Let’s ask the professionals. Meet Paweł and Michał from CodiLime — a strategic IT partner for innovative companies — talking about Rust.

What is Rust?

Michał: Let’s start with a quick explanation of what Rust is. First, the language was kicked off by Graydon Hoare, then it was absorbed by Mozilla (version 1.0 was launched in 2015). They wanted to create a programming language that would be user-friendly and, at the same time, able to solve two serious problems: concurrency and parallelism. As it was meant to be used as code in a browser, it should have been efficient. It was supposed to be an alternative to C++’s Firefox codebase. Almost immediately, Rust shone through as a perfect language for safely solving multithreaded problems.

As for the name ‘Rust’, that’s actually taken from a plant fungus that is robust, distributed and parallel!

Paweł:. I would love to add some more about Rust.This programming language brings back techniques and solutions that were created in the past — in the world of ‘research’ programming languages — but never made it to the mainstream; they were never widely applied or used. Rust is a combination of ‘old’ technologies that nevertheless bring something new to the table.

Has the purpose of bringing Rust to life changed over time?

Michał: It’s worth highlighting that Rust was created with multithreaded applications in mind. It had to be secure and developer-friendly. However, the language was even more high-level, a bit similar to Golang. Then it evolved, sometime before launching the 1.0 version. It became more low-level so that it could be more easily used for kernel or even embedded programming. So, yes, the language evolved over time.

Paweł: Yes, and it’s something that has become a standard. Today’s technology is developing rapidly. You never know the direction it will go in the future. So, it’s crucial to have a standard that would serve as a base for further improvements.

Michał: Exactly! When I started my programming adventure, I tried out many languages. When I was introduced to Rust I thought, ‘Wow, so many things considered to be best practices in C++ are standard in Rust’. Many features were included just like that, all you had to do was write a simple character. To me, that was revolutionary.

Rust’s ecosystem

Paweł: But let’s be honest. Rust’s standards are strict, harsh even, and that can be a nightmare, especially for inexperienced developers. The compiler can literally kill your code. When you try to use solutions that may be wrong or not optimal, but work in other languages, you won’t be able to compile the code, or at least you’ll end up with a warning: No way! On the other hand, it increases the level of security — there is very limited space for bugs or human error, and everything is controlled. There are many checkers that verify what you want to do. Of course, in C++ there are also some linters and tools that make static analysis easy but in Rust, all those functionalities are just built-in. This was a huge WOW to me when I first encountered Rust.

Michał: Yes, in Rust, linters are developed and distributed alongside the compiler, they’re not an afterthought. If you squint hard enough, you can even say that in Rust, a linter and a compiler are the same thing. This is very refreshing and makes the language feel well thought-through and consistent.

Rust’s pros…

Michał: It’s a good moment to stop for a second and emphasize some of Rust’s advantages. What makes this programming language stand out from the crowd is a great combination of features — no previous programming language was this fast and low-level, while still being safe and productive. The compiler makes the code clear and correct. Thanks to the borrow checker and ownership system, references don’t outlive the data they refer to which eliminates entire classes of bugs caused by memory unsafety. You don’t have to think about running into memory safety risks which you do in other languages. Also, your project can be used as a library by other languages via a foreign-function interface but there is no garbage collector behind it. And Rust allows (but doesn’t force) you to write very low-level code. It is exactly this mix of useful solutions that means companies use Rust in their projects.

Paweł: All the buzz around Rust comes from one simple fact — the entire tooling of Rust is just a bundle available when you install the language. You don’t have to download, install, etc. You run one script rustup.sh and that’s it, you’re fully set and ready to go. And there is a package manager — Cargo — that handles so many tasks for you, including building the code, downloading the libraries your code depends on, building those libraries, etc. Finally, the language keeps most packages in one repository, which is another reason why the language is intuitive and developer-friendly. You have everything at your fingertips.

… and cons

Paweł: Sure, there are also disadvantages to the language. I don’t like Rust’s syntax, nor its learning curve. Rust is quite hard to start with, especially when compared to Python or even JavaScript. If you want to start programming in Rust, you need time to get familiar with it. And one more thing: libraries. Sometimes it’s difficult or even impossible to integrate, for example, a C++ library into your project.

Michał: You’re right about the learning curve… But there is the other side of the coin. Sure, an intern will not be able to write a new feature in Rust instantly but if they do and send a pull request, it won’t break the production. The compiler finds the bug to prevent it.

Where to use Rust?

Paweł: The popularity of Rust has been growing lately. The language is quick, stable, efficient, and powerful. Many giant players use it to create some of their components. There is Mozilla, of course, but also Amazon, DropBox, and many more. You may have also heard about the SoloKey project, for which the second version has been written in Rust.

Michał: From my point of view, Rust is great for almost everything; to name just a few: CLI, WebAssembly, network development (both basic backend and fundamental stuff like proxies) and Embedded (although, most developers are still used to C language.) Those are just four areas in which Rust shines, yet there is much more you can do with this language. I might be repeating myself, but Rust is a great driver that pushes developers to improve their technologies, libraries, and tooling so that they meet the highest industry standards.

Paweł: I would add one more type of project Rust rules in: bug-free software. By bug-free software, I mean avionics or autonomous vehicle software that may impact human lives, but at this point there is a lot to do here around the certifications and compiler itself..

Is Rust recommended for beginners?

Paweł: Nope, I don’t think Rust should be the first choice for newbies. Rust tends to “hide” certain mechanisms like race conditions which every programmer should know and learn when starting their journey with coding. Moreover, the “uniqueness” of Rust makes switching from another programming language pretty difficult for a beginner.

Michał: I too think Rust is not a perfect fit for a first programming language. Although I’m less concerned about things Rust hides, but instead the fact that Rust introduces its own concepts in addition to the usual programing basics, like control flow, functions, variables. This is helpful in the long run, but might be too much for a beginner. Thus I’d say Rust is a perfect second language — get your feet wet in, for example, Python and as soon as you’re able to produce something working, jump right into Rust.

Does Rust have a bright future?

Michał: Rust has a great community. Large, active, friendly, and supportive. No matter how simple or even silly your question is, you will be instantly supported with solutions and constructive feedback. There are many community events and conferences, both official and private. And the language itself is popular. Rust is powerful and complete, there aren’t many limitations or constraints.

Paweł: Rust is comprehensive. It works for multiple types of projects.

Michał: Exactly. I would say that Rust will definitely take over some areas where C or C++ are currently used. I’m actually pretty positive that C++ will stop being considered for new projects, at some point. Perhaps Rust will even nip a part of Golang’s or Python’s market share? I am very optimistic about that.

Summary

This conversation was between two software engineers working at CodiLime.

Paweł Dulęba has been an embedded developer for over ten years now. He has been developing solutions for both everyday technologies and sophisticated server solutions.

Michał Krasnoborski is an expert in performance-critical code, and not only in the area of networking. He has been a fan of Rust since before version 1.0 was even released.

This article is based on the podcast “Porozmawiajmy o IT” which is run by Krzysztof Kempiński who has given his permission to publish the interview in English. Michał and Paweł were guests of the episode about Rust, which you can listen to in Polish HERE.

--

--