Fluent Refactoring
summary
Refactors a messy 50-line Rails controller method by actually changing code not theory: extracts a method object (replace method with method object), uses a temporary method_missing hack to keep tests green, applies flatten nested conditionals to expose a guard clause, extracts five private helpers, moves HTTP concerns into a responder pattern, then splits that into Ajax and HTML responders (replace conditional with polymorphism) and eliminates duplicated xhr checks; tests run green throughout and the refactor reduces noise and duplication.
AI-written summary · about
chapters (12)
- 0:00Start
- 1:13Algebra Isn't Math
- 1:49Math is a Language
- 4:46Language Hunters
- 4:58Levels of Proficiency
- 6:32Production Rails Code
- 8:08Complexity
- 9:16Make the Job Smaller
- 20:09Recap
- 22:00Replace Conditional With Polymorphism
- 25:30Throw Your Work Away
- 26:10Speed Up Your Tests!
related talks
35mFluent Refactoring
33mSo You Want to Start Refactoring?
29mLet’s refactor some Ruby code
48mRefactoring from Good to Great - A Live-Coding Odyssey
40mWorkshop - Simplifying Code: Monster to Elegant in Less Than 5 steps
26mTherapeutic Refactoring
25mRefactoring: The ASMR of Programming Talks
44mRefactoring from Good to Great
