Don't Copy and Paste from Stack Overflow
Why you shouldn't implement the copy/paste design pattern.
April 19, 2019 by Keith Ott
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.”
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.
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.