October 2023

Why will Rust save you money?

Dr J. Rousselot

A great product market fit

Software is eating the world as say some venture capitalists. As a consequence, many programming languages have emerged with various application domains. To name a few: Python, ReactJS, NodeJS, Solidity. These languages make trade-offs. Either in performance, in security, or in scalability.

More generic languages such as C++, Java, Kotlin are more difficult to learn. But they solve a wider range of software engineering problems and scale better.

Rust is part of the second category. It requires more effort to learn, and it introduces novel concepts. At the same time it is not as difficult as C++.

Not all developers will enjoy learning these new concepts. The wider job market might push them to. Once a developer knows Rust, they can apply this knowledge to a wider set of problems. They can also work with more developers, and re-use high quality open source libraries.

The same is true for a business. The cost of switching to Rust is offset by the larger ecosystem. Microsoft, ARM, Google, Amazon provide long lasting financial support to the Rust Foundation. And the wider market makes it easier to hire developers.

Many programming languages failed due to a lack of developers and niche markets. They were bad for business.

Advanced technology is indistinguishable from magic

One of the biggest issues with programming is memory management. C and C++ give developers direct access to memory. Unfortunately, memory mis-management has caused most software security issues and incorrect system behaviour. These errors are very difficult to debug. Rust makes most of those impossible by detecting them at compilation time. The Rust typing system forces developers to identify the type of data stored in memory. Rust detects when a text is mis-interpreted as a number, or when a function overwrites data. And it forces the developer to fix it before going into production.

In December 2021, a vulnerability of this type was found in the log4j library used by many Java products. Attackers stole confidential information from many businesses.

A friendly compiler

With C++, error messages are often associated to a line in a file that don't make sense to the developer. This costs days of work until the developer fixes the error in a completely different file.

Rust provides useful error messages. Tired developers will mistype a variable name, missing a character. C will fail compilation with an "unknown symbol" error. Javascript will keep executing the code with dangerous consequences. Rust will detect this and make the correct recommendation.

Besides friendly error messages, Rust code is much easier to read and write than Java. Java also has a strong typing system and error handling. But it is tedious to read and write. Rust enables developers to focus on the core issues.

Performance

When dealing with large datasets or number of users, efficiency matters. Efficient memory management minimises surprises such as memory leaks. Better error handling frees up system resources.

Speed also matters early on. It enables developers to iterate faster between code changes, compilation and test deployments.

Rust optimises code at compilation, with no overhead compared to C++. With Java, memory management can suspend software execution at any time.

Rust improves the quality of the codebase, and minimises technical debt.

{item.article_image.alt}

Conclusion

Rust has been the most loved programming language for the past seven years on Stack Overflow. It is more developer friendly, fast, and prevents many difficult bugs. Save money on your next development project by adopting Rust!