Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Three Principles To Bring Your Legacy Code Into the Future

Three Principles To Bring Your Legacy Code Into the Future

Roland Weisleder

December 11, 2023
Tweet

More Decks by Roland Weisleder

Other Decks in Programming

Transcript

  1. What is Legacy Code?* • Untested software lacking modern practices.

    • Software written in outdated languages or techniques. • Pre-existing codebase without sufficient documentation. • Code maintained long after its initial development. • Old software that still affects current operations. *According to ChatGPT
  2. • What about the input format? • What about malformed

    input? • What about null? • What about thrown exceptions?
  3. I want to test private methods Private methods are independent

    units in disguise. Extract, document and test.
  4. I have to mock everything So the method does nothing

    useful? Keep it simple, delete the method.
  5. Inverted TDD Refactor to understand the code Green Write a

    new test Red Hopefully not after reverting the refactoring