Published Sep 3, 2019

SE-Radio Episode 295: Michael Feathers on Legacy Code

Michael Feathers delves into the intricacies of managing legacy code, offering insights on assessing code quality, strategies for effective refactoring, and the critical role of testing. He contrasts legacy systems with new projects, underlining the importance of understanding historical context and maintaining transparent communication with stakeholders.
Episode Highlights
Software Engineering Radio - the podcast for professional software developers logo

Popular Clips

Episode Highlights

  • Refactoring

    Refactoring legacy code is crucial for improving its testability and maintainability. emphasizes the importance of making codebases adaptable by minimizing changes needed to add new features. He introduces the concept of characterization testing, which involves understanding existing code behavior before refactoring 1. This approach helps developers avoid unintended consequences, such as breaking dependencies that users rely on. Additionally, discusses techniques like parameterizing constructors to manage dependencies and make code more testable 2.

    It's more like what should the code look like to make this easy? What does it take to actually get there?

    ---

    These strategies are essential for maintaining and evolving legacy systems efficiently.

       

    Testing

    Testing plays a pivotal role in managing legacy code, ensuring functionality and facilitating changes. explains that tests serve as a persistent debugger, providing insights into code behavior and supporting safe modifications 3. He advises developers to focus on writing tests that help them understand the code, rather than achieving full coverage. This approach allows for gradual improvement in test coverage, driven by the need for specific changes 4.

    Tests are a way of asking questions of a code base.

    ---

    By prioritizing areas of the code that are likely to change, developers can efficiently allocate testing resources and ensure robust legacy systems.

Related Episodes