Don't Copy and Paste from Stack Overflow

Why you shouldn't implement the copy/paste design pattern.

I recently saw an post online asking “Why should I hire a software engineer if I can just copy and paste from Stack Overflow?” The answer was “Copy pasting: $1. Knowing what code to copy paste: $100,000/year.”

A screenshot of the famous 'Don't copy that floppy' anti-piracy campaign, featuring the rapper standing in front of a background that reads 'Don't copy that floppy'.
The only thing worse than copy and pasting code is copying that floppy.

Joking aside, it reminded me of a conversation I overheard years ago between an intern and a more experienced engineer:

Experienced engineer: Why did you write this code? What does it do?

Intern: Um… I’m not sure, I just copied and pasted it from the Internet.

I’m not making fun of this intern; in fact, at one time or another, we’ve all blindly copied and pasted code from the Internet. If we didn’t, then these kinds of jokes wouldn’t exist. We all know it’s bad, but what specifically is so wrong?

Missed Learning Opportunity

First, you’re giving up your opportunity to learn something new. By just blindly copy and pasting a code sample, you’re giving up the experience you would have gained if you wrote it yourself.

It’s Unprofessional

Second, it’s unprofessional. I’m not trying to get pretentious here, but you have a certain responsibility to your employer, your co-workers, and to the system. You’re there to build and maintain the system, and if you’re dumping any old code into it, are you really living up to your responsibilities?

It Makes You Look Bad

Third, it makes you look bad when you don’t know why something does – or doesn’t – work. If you’re adding to the code base and you have no idea what or how it does things, how will your fellow engineers, your boss, and your end users view you? Probably not very good.

I think sites like Stackoverflow are a great resource, but they’re just that: a resource. You shouldn’t just blindly trust what they have to say, because at the end of the day, you’re the one who knows what’s best for your code base.

Back to Blog Posts

You may also like:

Software Engineer vs. Computer Programmer

What is the difference between a software engineer and a computer programmer? Read more...

New Windows Game: Green Tea Reversi

Command-line reversi that supports all rules and any combination of human and AI players Read more...

New Web App: Simple Stock Ticker

Check stock prices with this React web app