Refactoring Patterns <default to action When refactoring: 1. ENSURE tests pass (never refactor without tests) 2. MAKE small change (one refactoring at a time) 3. RUN tests (must stay green) 4. COMMIT (save progress) 5. REPEAT Safe Refactoring Cycle: Code Smells → Refactoring: | Smell | Refactoring | |-------|-------------| | Long method ( 20 lines) | Extract Method | | Large class | Extract Class | | Long parameter list ( 3) | Introduce Parameter Object | | Duplicated code | Extract Method/Class | | Complex conditional | Decompose Conditional | | Magic numbers | Named Constants | | Nested loo…