TUTORIAL: Refactoring without a net
summary
Shows how to refactor risky legacy code without a full test suite by capturing current behavior as golden outputs with ApprovalTests and running a 30-day characterization test against the Gilded Rose kata. Demonstrates concrete steps in PyCharm: create received/approved files, approve golden output, rename and extract methods, inject a bug (plus→minus) and see it fail, then apply strategy/factory patterns to replace nested ifs. The demo builds working approval tests and a refactored item-based updater that passes the preserved-behavior checks.
AI-written summary · about
chapters (13)
- 0:00Introduction and setup
- 1:06Speaker introduction
- 3:15What is refactoring
- 13:46Approval tests introduction
- 23:28Exercise overview
- 27:01Gilded Rose exercise setup
- 33:43First exercise preparation
- 46:07Refactoring patterns overview
- 57:03Step-by-step refactoring demo
- 1:18:18Strategy pattern approach
- 1:37:04Strategy pattern implementation
- 1:38:49Factory and new features
- 1:41:22Refactoring confidence summary
related talks
43mFrom 0% to Cleanly Refactored 100% tested code
35mRefactoring Frenzy - Don't settle for short term
45mAdd Tests to Legacy Code with Approval Tests
48mA deep dive into the Gilded Rose
35mQuickly and Safely Refactoring Legacy Code
31mGilding the Rose: Refactoring Legacy Code
01h 25mGetting a Handle on Legacy Code
01h 02mQuickly Testing Legacy C++ Code with Approval Tests
