SE Radio 656: Ivett Ördög on Rewrite versus Refactor
Feb 20, 2025
auto_awesome
Ivett Ördög, creator of LeanPoker and a thought leader in software development, shares insights on the often contentious choice between rewriting and refactoring code. She challenges the conventional wisdom of avoiding rewrites, discussing conditions for successful large-scale transitions. Ivett also examines the implications of legacy code, the role of technical debt in startups, and strategies for obtaining management support. Their conversation highlights incremental improvement versus large-scale changes, emphasizing customer value during software evolution.
Refactoring is often the preferred choice for improving code, but significant changes to system logic can necessitate a rewrite instead.
Successfully managing technical debt requires careful consideration and a balanced approach to ensure sustainable growth without overwhelming the system.
Deep dives
The Refactor vs. Rewrite Debate
The podcast delves deeply into the complex decision-making process between refactoring and rewriting code. Refactoring involves making incremental changes to improve code structure without altering its behavior, while rewriting means starting from scratch with a new codebase. The conversation highlights that refactoring should ideally be the first choice, but may not always be feasible due to situations where the fundamental system logic itself must change. Acknowledging when to transition from refactoring to rewriting can be critical, and it's emphasized that thoughtful evaluation is needed to avoid significant pitfalls.
Understanding Legacy Code
Legacy code is often perceived as any code that lacks tests, but the podcast presents a broader interpretation. The discussion suggests that legacy code can also be regarded as any code that developers feel uncomfortable working with, regardless of whether tests are present. Through examples, such as a PHP codebase that became difficult to maintain due to its complexity and poor initial development practices, it's shown that merely adding tests to problematic code will not render it maintainable. The key takeaway is that both the technical and psychological aspects of working with legacy code should be considered.
Navigating Technical Debt
Technical debt is likened to financial debt in that it can be a conscious decision for companies to accept some level of it while focusing on growth. The podcast discusses how startups often leverage technical debt strategically to defer architectural decisions and prioritize rapid feature delivery. However, the conversation warns that teams should manage this debt wisely, as unchecked technical debt can accumulate and become burdensome, especially in large-scale systems. Real-world examples are shared where companies faced catastrophic technical debt, emphasizing the importance of finding a balance between speed and maintainability.
Incremental Improvements Over Big Changes
The podcast underscores the significance of incremental improvements rather than committing to all-or-nothing approaches when it comes to rewrites or refactoring. Smaller, manageable chunks of work allow for continuous delivery and validation of value, reducing risk and increasing adaptability. It's suggested that organizations should aim for releasable increments every couple of weeks to avoid the danger of becoming overwhelmed by larger projects. This philosophy resonates with the need for agility and responsiveness in software development, enabling teams to make necessary adjustments based on real feedback.
Ivett Ördög speaks with host Sam Taggart about rewrite versus refactor -- a choice that many projects face as they grow. It's a topic that inspires a lot of dogmatic feelings. They discuss how companies and projects end up at this crossroads and consider some strategies to try to avoid it. Ivett challenges the myth that you should never rewrite but points to two key factors that need to be present for a successful large-scale rewrite or refactor. They end by talking about how to get management on board for such large-scale rewrite or refactor projects.