Brendan Enrick

Daily Software Development

Copy Paste Programming

One of the most well known anti-patterns is copy paste programming. I am sure that every programmer has done some copying and pasting of code. It’s easy to do and can make writing code a lot faster than just writing new lines for everything.

You might have done something very similar to what you need now. All you have to do is copy the previous code and update it to fit your current needs. What could possibly go wrong?

I don’t think I need to explain why this one is bad. I think it’s easiest to just say that more code means more maintenance. It makes things messier, harder to read, and harder to change.

The month of September 2012 is the Copy Paste Programming month in the NimblePros Software Craftsmanship calendar, so consider this your reminder to stop copying and pasting code. You should know better already.

CopyPasteProgramming

I loved how well this image turned out. I’m sorry though, it’s not OK to copy and paste your code. No, it doesn’t matter that you’re making slight changes each time you copy it. Just don’t.