Copy-and-paste is clearly bad if you don't know what you are doing. But ALL programming is bad if you don't know what you are doing.
Copy-and-paste is bad even if you know what you are doing because a program with a lot of duplication is hard to change. You might need to change every copy of a code fragment, and you won't even know where they are. Copy-and-paste is not bad for a quick hack, and in fact XP programmers often use it to get a test working. If your new test is similar to your old test, perhaps the new code will be similar to the old. Copy the old code and hack on it until it works. The result will be a lot of duplicate code, but the XP programmer will then refactor it to remove duplication.
Comment