DEV Community

Discussion on: Do you copy and paste code from Stack Overflow?

Collapse
 
picocreator profile image
Eugene Cheah

In very limited cases yes. But only to save time, and not without understanding.

At the heart of it, there is nothing wrong copy-and-pasting code, especially glue/boilerplate code. However what I find is the bigger "crime" is to copy-and-paste without understanding.

Understand the very code you are pasting. In programming over a decade, I still find myself sometimes searching up very fundamental pieces of code (eg. array sorting), especially when I jump from one programming language to another.

My benchmark would be for junior programmers. If copy pasting, would probably save you 5 to 10 minutes instead of writing the code manually. With pretty much the exact same result. Then its alright, because as a paid programmer, I too have a responsibility to be efficient in my work. However if you do not understand what you are pasting, stop!

Naturally as you mentioned, naming convention, and syntax styling, if those do not match, I would do a quick refactoring.