4 reasons why you should learn Rust in 2021 – and maybe even have fun doing it
February 22, 2021
Rust is a modern programming language that focuses on thread-safety and performance. Unlike in many higher-level programming languages, there is neither a garbage collection nor a virtual machine in Rust. Instead, Rust addresses known problems of long-established low-level programming languages such as C or C++. At the same time, the programming language is known for its steep learning curve, which makes many developers shy away from delving into Rust. We provide four reasons to show that Rust, despite its complexity, has benefits that will make your work (and live) with the language easier.
Rust: low-level language with abstractions from higher-level languages
The low-level language Rust is so efficient that it can do without automatic garbage collection. Nevertheless, it offers the performance of C and C++, but without the pitfalls that developers have to know and consider at work.
The developers behind Rust wanted to create a language that would make system-level programming more secure and concurrency, i.e., the simultaneous execution of several calculations, instructions, or commands. Both memory security and concurrency errors occur when code accesses data that shouldn't be accessed at the time.
The package manager
Rust is one of the few programming languages that has a built-in package manager. The package manager is called Cargo and is valued by developers due to its comparatively simple usability. With TOML, it uses an easily understandable syntax that can be learned thanks to its precise semantics quickly.
name = "project"
version = "2.0"
authors = ["WeAreDevelopers"]
image = "0.23.5"
The fact that you don't need build scripts doesn't mean that they aren't possible. Build scripts are used, for example, when linking to C or C++ libraries and can be customized where necessary. Cargo has integrated unit and integration testing. In contrast to other languages, in which developers often have many testing suites at their disposal, which themselves have to be learned, this is a great advantage.
The Rust compiler is well-conceived and has a lot of features that other compilers lack. On the one hand, the output is color-coded, which contributes significantly to its readability. The error output is very detailed – the compiler provides a lot of context, making it easier for developers to find the cause. In many cases, it tells you what causes the error and where you can find the cause – by highlighting the relevant code and displaying it directly in the terminal, accompanied by further explanations. In many cases, it even provides a fix for the error. If that is not possible, it will at least suggest a command – rust --explain [error-code], which you can use to display further explanations. Unlike in other languages, this command doesn't just show you a URL; instead, the documentation is opened directly within the terminal.
In general: the programming language design
Rust's safety-first approach makes life difficult for learners. Still, ultimately there is only positive to be gained from it, and yes, concerning the developer experience: Rust forces programmers to deal intensively with memory usage. This contributes to Rust having a steep learning curve, but it also means that Rust applications are very safe and less prone to errors, which ultimately means less debugging for you. Rust's memory security is likely to be one of the main reasons for the growing interest in the programming language supported by Mozilla.
It was only in October 2020 that AWS invested heavily in Rust. According to the latest reports, Microsoft is also showing great interest in Rust, contributing to further developing the language and using it for its products in the future. According to a blog post by the in-house security team from 2019, around 70 percent of security problems that the Microsoft Security Response Team assigns a CVE number – the acronym stands for Common Vulnerabilities and Exposures – are directly related to storage security. If program languages like Rust were in place, these problems would probably not arise, the blog's authors concluded at the time.
Want to start learning Rust now?
GitHub user Dhghomon has created a repo that explains the programming language’s basic concepts and offers help to get started. Dhoghomon writes that while Rust already has many useful resources for learning the language, most of them are written in English, which could be a hurdle, especially for non-native speakers. For this reason, the Rust developer and linguistics enthusiast has created a repository called Rust in easy English, where he explains central programming concepts in simple language.
The repo reads a bit as if the individual features and code snippets were verbally explained by a patient colleague, whom you can watch over the shoulder for a day. Only one question remains: Why is this not available for all programming languages?