Incremental refactoring restructures a mature production system through small, controlled changes instead of a big-bang rewrite. It balances performance improvements and technical-debt reduction with ongoing feature delivery, user requests, and service reliability. section 1.0
A practical incremental refactoring process uses four stages:
- Plan the improvement target, the code to change, and the interface between existing and new code. section 1.6
- Mirror existing functionality in Rust, then integrate the new implementation into the existing codebase. section 1.6
- Verify new functionality with Rust testing facilities and compare results from existing and new code paths. section 1.6
- Choose a deployment approach that rolls out the refactored code without affecting end users. section 1.6
Rust supports this approach with strong typing, ownership and lifetime guarantees, direct memory sharing across FFI boundaries, and thread-safety guarantees. These features can target memory safety in C or C++ systems and performance in interpreted, garbage-collected systems such as Python. section 1.3 section 1.6
Figure 1.2 Overview of the refactoring process that we discuss in this book
Use the process overview to trace planning, implementation, verification, and deployment as connected stages. section 1.6
