Last Revision — April 19, 2022
1 Min Read
Clones Code Clone Duplicate Code Common Methods in Sibling Class External Duplication
Dispensables
Duplication
Within a Class
- Alternative Classes With Different Interfaces (co-exist)
- Oddball Solution (co-exist)
- Incomplete Library Class (caused)
- Magic Number (caused)
- Required Setup/Teardown Code (caused)
- Type Embedded In Name (caused)
Martin Fowler in book (1999): "Refactoring: Improving the Design of Existing Code"
Duplicated Code does not need further explanation. According to Fowler, redundant code is one of the worst smells [1]. One thing is that this makes it more challenging to read the program. Checking whether the copies are identical is yet another issue - looking at whether there are for sure no tiny differences between code blocks in search of Oddball Solution further unnecessarily absorbs developer time. Yet another thing is that whenever a change is made, one needs to check if this should have happened to just one or all of the existing copies of code, wherever they are.