Huh? Are people really asking that question? That was my reaction when seeing the question "Is it okay to use Stack Overflow at work?" But yes, someone asked the question. In fact, there are multiple variations of that question online from different people. And, some people even think that yes, it's cheating.

The video above is my response to the question. Here's the summary:

Would Your Boss (or Customers) Pay You More If...

Would your boss pay you more if he/she knew you came up with the code all by yourself? What if he/she found out it took you days longer to do so? Or, if you're like me and have your own company, would your end customers pay you more knowing that the software they're buying is "all original code?" After all, it took you 2-3 times longer than simply asking someone else for help. The answer should be obvious: NO. In fact, your boss would be angry at the time wasted, and your end customers couldn't care less. What matters to them, is that your code does what they need it to.

Likewise, would your boss have any objection to you asking your colleagues for help? Of course not! Well, StackOverfow - and similar websites - are global communities of colleagues who you can go to for help. We work for different companies, but we help each other out.

Conclusion: of course it's okay to get help and copy code from StackOverflow. Don't waste time "reinventing the wheel."

Let Go Of Your School Mentality

In school, we're taught that copying from others is cheating. That's because you need to demonstrate that you personally understand what has been taught. You need to show that you're capable of figuring it out.

At work, you're paid for results. So you need to unlearn the idea that copying from others is cheating. You're supposed to collaborate with others. And, coming up with your own unique solutions to problems that the industry has already figured out is, generally, a gigantic waste of time and effort. Nobody will reward you for being 100% original.

Added to that, it's almost impossible to be 100% original. Completely new ideas are very rare. Most new ideas are a combination of old ideas brought together in a new way (e.g., a unicorn is a horse with a horn on its head). New ideas are built on top of old ideas.

So, if you're entering the workforce; it's time to let go of the idea that you need to figure everything out yourself, and copying is bad.

Blind Copying is Dangerous

Yes, you can copy, but you do so blindly at your own peril. Code snippets on StackOverflow are often thrown together specifically to answer the question you asked, or to demonstrate a concept. The code may not even have been tested!

Example code often misses things such as error checking, which are irrelevant to the example, but critical to production quality code. So, copy blindly, and you may well be introducing serious bugs and security loopholes into your code. For example, code that queries a database needs to sanitize any user inputs to protect against SQL injection attacks. Failing to do so is dangerous. You're opening a loophole for malicious database access.

So, copy code examples, but make it your own. And, take the time to add the necessary error and security checks.


In the video, I forgot to mention crediting others when you use their code. It's good practise to credit others for their work. And, knowing where an alogrithm came from can be handy further down the line when your code is reviewed (by others or yourself).