Refactor: Dedupe and Cleanup
Eliminate redundancy and remove dead code.
Deduplication Patterns
- Extract Common Method
Move duplicated logic to shared function.
- Template Method Pattern
Abstract common structure, vary details.
- Consolidate Conditional Expression
Combine conditions with same result.
Dead Code Removal
Types to Remove
-
Unreachable code - after return/throw
-
Unused variables - declared but never read
-
Unused functions - never called
-
Commented code - use git history instead
-
Unused imports - clutters namespace
Safe Removal Process
-
Search for all references
-
Check for reflection/dynamic usage
-
Remove in small commits
-
Run full test suite