Rewrite (programming)
In computer programming, rewrite is the act of authoring new source code to replace an existing codebase from scratch or to significantly modify an existing codebase such that the resulting code maintains essential aspects of the original. The essential aspects to be maintained for a rewrite effort may differ but often include behavior, performance and interface. The result of the effort is also called a rewrite.
Motivations
Common motivations for rewriting software include:- The source code is not available or is protected by an incompatible license.
- The code cannot be adapted to a new target platform; perhaps a different programming language must be used, since there is no support for the original code on the target platform.
- The code is too difficult to understand, maintain, extend or debug.
- There is a desire to use new techniques or technologies, especially when desired enhancements would require significant change.
Risks
The incremental rewrite is an alternative approach, in which developers gradually replace the existing code with calls into a new implementation, expanding that implementation until it fully replaces the old one. This approach avoids a broad loss of functionality during the rewrite. Cleanroom software engineering is another approach, which requires the team to work from an exhaustive written specification of the software's functionality, without access to its code.