Topic summary

Code duplication

Code duplication

Extracted from the Wikipedia article Duplicate code.

Cost

However, not all code duplication can be refactored. Clones may be the most effective solution if the programming language provides inadequate or overly complex abstractions, particularly if supported with user interface techniques such as . Furthermore, the risk of breaking code when refactoring may outweigh maintenance benefit. A study by Wagner, Abdulkhaleq, and Kaya concluded that while additional work must be done to keep duplicates in sync, if the programmers involved are aware of the duplicate code there weren't significantly more faults caused than in unduplicated code.