Surgically Refactoring Ruby with Suture
summary
Suture is a Ruby gem that makes refactors incremental and reversible: it records calls and replays them (SQLite + Marshal snapshots), verifies recordings as disposable characterization tests with Suture.verify, and lets new and old implementations run staging side-by-side comparisons or run both paths with dup and call_both. In production it logs mismatches and can fallback to the old code on error, then be removed once the refactor proves safe.
AI-written summary · about
chapters (16)
- 0:00Start
- 2:38Welcome to
- 7:58Early success: Making it easy to make new things
- 9:09To change the design of code without changing its observable behavior.
- 9:34Legacy code has many definitions
- 9:48Legacy Code - noun Code we don't understand well enough to change confidently.
- 10:01Today, let's refactor some legacy code
- 14:11Feature #1 Erodes Technical Debt trust in the team
- 24:20Two Bug Fixes
- 25:18Calculator tally service doesn't handle odd numbers correctly.
- 32:42Trial #1 Characterization tests
- 35:51Write real unit tests
- 39:06What about Active Record?!
- 40:42Discoverable configuration
- 41:34Wait, why did verification fail?
- 42:41Another huge error message








