One Small Step
summary
Ruby code that generates a children’s song gets refactored end-to-end: a characterization test captures existing output, the lyrics are split into verses, string templates separate data from algorithm, primitive obsession is fixed by introducing a critter object with name, qualifier and aside, and the data becomes injectable. Tiny, safe steps keep tests green; a tiny contrived test catches an a/an bug, gets fixed, and the new flexible generator works and supports arbitrary creature lists.
AI-written summary · about
chapters (11)
- 0:00Introduction to refactoring
- 1:53Why refactor code
- 5:28Starting the refactoring process
- 8:18Breaking down verses
- 12:53Separating algorithm from data
- 16:46Handling conditionals in refactoring
- 20:36Introducing the critter object
- 23:01Removing hard-coded constants
- 25:50Fixing verse assumptions
- 27:36Final adjustments and testing
- 28:41Key takeaway small steps
related talks
39mAll the Little Things
46mThe Surprising Effectiveness of Small Steps
46mLittle Snippets
21mBlank Page Panic! Creating Confidence with TDD
31mAn Optimistic Proposal for Making Horrible Code... Bearable
40mWorkshop - Simplifying Code: Monster to Elegant in Less Than 5 steps
25mRefactoring: The ASMR of Programming Talks
48mRefactoring from Good to Great - A Live-Coding Odyssey
