Skip to main content

Refactoring

"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." - Martin Fowler


"Always leave the code cleaner than you found it." - Robert C. Martin

Originating from Object-Oriented Programming, refactoring is also known as incremental refinement and maintains the semantics of functionality while altering only the design. Refactoring is a change made to the internal structure of the software that makes it easier to understand and cheaper to modify, without changing its observable behavior.

Refactoring, tech debt cost over time

Refactoring plays a crucial role in managing technical debt, which results from design choices or code implementations that save time in the short term but increase complexity and maintenance in the long run.

Refactoring allows the XP team to address this debt by restructuring the code to make it cleaner, more efficient, and easier to maintain.

Although refactoring involves an initial cost in terms of time and resources, it reduces technical debt over time, saving more resources in the long run. Therefore, the analysis of refactoring should consider the initial cost and long-term benefits in terms of reduced complexity, error correction, and improved software quality.