3 ms·
One of the best tips I have gotten from the internet is to never copy and paste code you have not written yourself. Even rewriting it verbatim makes you think a
by megalodon 5y ago
One of the best tips I have gotten from the internet is to never copy and paste code you have not written yourself. Even rewriting it verbatim makes you think about what it is you are actually copying.
It's a pretty neat rule to have in mind.
- deleted 5y ago[deleted]
- corobo 5y agoWhen you get into this habit it also makes it easier to translate solutions from other languages too
- deleted 5y ago[deleted]
- dcow 5y agoIt's also good legal advice. It's now legally possible for you to copy and paste code directly from stack overflow because they made an effort to assert a compatible license over works published on their site. However, the same can't be said for most other code snippets flying around out there.
- distances 5y agoGood point in case: license of the code in this exact article is very likely incompatible with your production code.
- jozvolskyef 5y agoLadislav Vagner, a legendary programming tutor at FIT CTU, is a known proponent of being extremely cautious when copying code, even your own. He gives programming proseminars where students guide him as he codes the solution to some problem, e.g. mathjax-like typesetting in C++. It is a common theme in the proseminars that a bug is introduced by copying code. Probably on purpose, like many of the other bugs that students are supposed to point out.
- tshaddox 5y agoI think that’s true if you’re trying to learn a new tool or technology. You probably won’t learn as much following the Rails or Django tutorials if you’re just pasting all the code. But if you’re just looking for some esoteric workaround for some very specific tool and use case, I think it’s fine to paste. And the latter makes up the overwhelming majority of my Stack Overflow visits.
- ImprovedSilence 5y agoAgreed. Otherwise it's not uncommon for me to not know what 80% of the code is even capable of...
- specialist 5y agoYes, and: I didn't really grok Test Driven Development until I worked thru the book, line-by-line, experiencing the workflow. Knowledge vs experience.