Code Smells: Your Refactoring Cheat Codes
summary
A usable backend that takes UDP lines and posts to Google gets rewritten from a 30‑line script into discrete objects while tests keep it safe: manual checks with netcat and a real phone confirm behavior, then RSpec + Webmach mock the Google API for automated regression. Key moves include replacing the script with a method object, extracting worker/job and UDP server/client roles, using shellwords tokenization and a null‑job to avoid nils, and the refactored system still works.
AI-written summary · about
chapters (18)
- 0:00Intro
- 0:38Code smells are heuristics for refactoring
- 0:55Our design communicates to us through resistance.
- 1:09This resistance is valuable feedback
- 6:12Code Smell Long Method
- 7:34Replace Method with Method Object
- 8:17Extract Method
- 9:20Code Smell Divergent Change
- 12:23Code Smell Inappropriate Intimacy
- 15:37Code Small Case Statement
- 16:39Replace Conditional with Polymorphism
- 21:22Data Clumps
- 23:18Feature Envy
- 24:25Code Smell Same Name, Different Meaning
- 25:40Code Smell Primitive Obsession
- 26:40Shellwords
- 28:04Nil Checks
- 28:50Introduce Null Object
related talks
48mRefactoring from Good to Great - A Live-Coding Odyssey
47mRefactoring from Good to Great
44mRefactoring from Good to Great
54mPractical Advice for Maintaining and Migrating Working Code
40mHow To (Semi-)Automate JavaScript Refactoring
35mFive Lines of Codes
50mGuide Refactorings With Behavioral Code Analysis
31mAn Optimistic Proposal for Making Horrible Code... Bearable
