Refactoring Legacy Code Guided by Simple Design
summary
Walks through a real legacy Java module and performs safe refactorings guided by the Four Rules of Simple Design: enable Eclipse warnings, remove dead code, and shrink a constants file into its owning classes. Uses the Unnecessary Code Detector to drop ~149 unused items down to zero, runs tests under EclEmma coverage, and writes characterization JUnit tests with Mockito mocks to capture behavior before changing it. Extracts methods, renames for intent, consolidates duplicated assertions, commits after each step, and ends with full branch coverage so new features can be added safely.
AI-written summary · about
chapters (14)
- 0:00Introduction
- 0:56Legacy Code
- 2:08Dead Code
- 2:56Remove
- 5:31Find Dead Code
- 6:25Remove Unused Code
- 10:53Remove Unused Classes
- 12:56Revealing Intent
- 15:34Renaming
- 16:49Extract Method
- 18:48Characterization Tests
- 26:04Testing System
- 36:14Refactoring
- 37:18Code Coverage
related talks
01h 00mTesting Legacy Code & Refactoring Patterns
42mWorking Effectively with (Android) Legacy Code
35mQuickly and Safely Refactoring Legacy Code
37mIdentifying Code Smells
40mTesting Legacy Code: Safe Refactoring
23mClean Architecture? Clean Code? Refactoring? Tests? What does this change in my code?
40mSelenium and the Four Rules of Simple Design
55mUnit Testing Like a Pro - Towards a Testable Design
