Copy-and-paste programming

The result risks being a disjointed clash of styles, and may have superfluous code that tackles problems for which new solutions are no longer required.

A further problem is that bugs can easily be introduced by assumptions and design choices made in the separate sources that no longer apply when placed in a new environment.

Such code may also, in effect, be unintentionally obfuscated, as the names of variables, classes, functions and the like are typically left unchanged, even though their purpose may be completely different in the new context.

[1] Copy-and-paste programming may also be a result of poor understanding of features common in computer languages, such as loop structures, functions and subroutines.

Copying and pasting is also done by experienced programmers, who often have their own libraries of well tested, ready-to-use code snippets and generic algorithms that are easily adapted to specific tasks.

(This can be partially mitigated if the original code and/or the copy are properly commented; however, even then the problem remains of making the same edits multiple times.

This is most commonly seen in boilerplate, such as class declarations or importing standard libraries, or in using an existing code template (with empty contents or stub functions) as a framework to fill in.

Repetitive code being refactored by using an abstraction mechanism such as a function .
Difficulty and risk of maintaining code written by copy-paste programming