DEV Community


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

erikerskine profile image
Erik Erskine

I'd agree with your approach to learning from and understanding these answers.

I often search for code snippets to use, but I find typing them in manually a useful excercise, even if I end up with an exact copy. I treat the act of typing code myself like a constraint, ensuring I really do understand what that code does and I'm happy with it. And I'm taking responsibility for it from that point on too - after all, the answer may be incorrect, outdated etc.

I'd extend this principle to tools that generate boilerplate code. Where possible I'll try to generate the output somewhere temporary and consider it documentation. Then I'll copy it over a file or function at a time. Here I may well copy & paste, but the principles of understanding & responsibility apply in the same way.

Plus as you mention, there's almost always something you want to tweak anyway.

Forem Open with the Forem app