1 Why refactor to Rust
This chapter covers
- Why you may want to refactor an application
- Why Rust is a good choice for refactoring
- When it is and is not appropriate to start a refactoring project
- High-level overview of methods you can use to refactor your code into Rust
If you have ever heard of the Rust programming language, you may have heard of software companies rewriting their code in Rust from a slower, interpreted language. A few of these companies have published blog posts lauding the performance benefits of Rust over their previous systems, and they tell a very tidy story: other languages are slow and Rust is fast. Therefore rewrite your code in Rust and your systems will be fast.
While it may be tempting to think that we can all just rewrite our code when something better comes along, we all know the reality that software does not exist in a bubble of infinite resources. Performance improvements and technical debt payments need to be balanced with feature development, user requests, and the million other things that come along with modern software work. While re-implementing functionality in a new language, you also need to ensure that you are providing a consistent and reliable service to your users. How then, can a developer hope to improve their code base while maintaining the rapid pace of development & reliability expected?
The answer lies not in big-bang-style rewrites, but in incremental refactoring.