Refactoring can be used as a verb or a noun. As a verb, refactoring means to improve the design of a code without changing what it does. As a noun, it refers to an individual modification to a program that improves its design, without changing what the code does.

Refactoring is often compared to editing a written document. The goal of editing is not to change the overall intent of the written material, but to improve it. Likewise, refactoring code should improve the code’s clarity, its simplicity, and its maintainability, but it shouldn’t change its purpose or even its behavior. Thus, refactoring should ideally be performed when code is covered by a suite of automated tests, so that after the refactoring process is complete, the tests can be run to ensure the code’s behavior remains unchanged.

References

Comments are closed.