Fluent Refactoring
summary
Refactors a gnarly 50‑line controller action pulled from an 800‑line Rails controller into a call object, a replace method with method object move that uses a temporary method_missing/delegate hack, many small extracted helpers, a responder pattern split into ajax/html variants via replace conditional with polymorphism, and focused guard‑clause and flattened‑condition changes. Tests shrink from about 30s→0.5s. Result is a much smaller, readable core method, duplicated branches moved to responders, and behavior preserved and verifiable by fast tests.
AI-written summary · about
chapters (10)
- 0:00Start
- 4:03Language Hunters
- 12:39Replace Method with Method Object
- 17:01Flattened Nested Conditionals
- 23:29The Single Responsibility Principle
- 26:31Replaced Conditional with Polymorphism
- 29:41Embrace Duplication
- 31:16Perspective on Code Matters
- 32:34Practical Object Oriented Design
- 34:08Characterization Tests
related talks
28mFluent Refactoring
33mSo You Want to Start Refactoring?
48mRefactoring from Good to Great - A Live-Coding Odyssey
26mTherapeutic Refactoring
25mRefactoring: The ASMR of Programming Talks
54mGet better at Refactoring
40mWorkshop - Simplifying Code: Monster to Elegant in Less Than 5 steps
44mRefactoring from Good to Great
