First Do No Harm: Surgical Refactoring
summary
A clear method for changing living legacy code: diagnose with preop/operation/recovery stages, add RSpec specs to cover and modify behavior, and extract and test the sed command and its Ruby regex character by character. Example refactor converts old Ruby hash syntax to 1.9 form by writing real files, verifying before‑and‑after contents, hitting a failing test when a regex change breaks sed, reverting to keep behavior safe, and treating production rollbacks and risk tolerance as developer responsibility.
AI-written summary · about
chapters (12)
- 0:00Start
- 0:29Benefits to Refactoring
- 1:30Is Refactoring Bad
- 1:47Approaches to Refactoring
- 2:40Surgical Refactoring
- 7:10Pre-Op
- 7:44Example of Surgical Refactoring
- 12:50Error Message
- 21:03Capture Group
- 29:51Recovery
- 30:26Qa
- 31:38Evaluate the Risk of another Change
related talks
33mSo You Want to Start Refactoring?
26mTherapeutic Refactoring
48mRefactoring from Good to Great - A Live-Coding Odyssey
40mHow To (Semi-)Automate JavaScript Refactoring
35mQuickly and Safely Refactoring Legacy Code
46mLittle Snippets
47mRefactoring from Good to Great
01h 04mRefactoring Is Not Just Clickbait
