Knowledge
Search knowledge... ⌘K
Knowledge · Anti-Patterns
Smell Duplicated Code
Anti-pattern indicating need for refactoring
Tags
refactoring-fowlercode-smellmaintainability
Impact
The same code structure appears in more than one place. If you see the same code structure in more than one place, you can be sure that your program will be better if you find a way to unify them.
Symptoms
- Same expression in two methods of the same class
- Same expression in two sibling subclasses
- Duplicated code in two unrelated classes
Source
Martin Fowler — Refactoring: Improving the Design of Existing Code, 1st Edition (1999)