Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple APILearn More
bagfox69828dWell then write your own.
Root7271728dCopy paste paste paste paste paste
jespersh757528dLittle tip: you learn slightly more from reading the code, then rewriting it yourself, even if 1:1, it helps you retain. Whereas copy paste.. not a chance
asgs900528dIf you don't like doing something, especially one that doesn't make you good, stop doing it
NoMad949928dGood, maybe. Fast, probably not.
C0D46226128dWriting it yourself increases ability to remember it, but that's not to say you can't copy/paste appropriate code and blend / rewrite it for your requirements.
Berkmann1881528dAs some wise people said, you shouldn't be copy-pasting it but typing it (even if it's verbatim).
And you may already know this, but copy-pasting isn't something you should rely on, especially if it's the main thing you do instead of coming up with your own solutions.
I mean, if you copy paste a short code and spend time reading and understanding it, it will never be as helpful as typing it because you'll
- better understand what it does, what's going on,
- see how the solution came to be vis-à-vis a problem it's trying to solve,
- realise how *you* would have done it (like, "oh! I'll have used this instead of or not put that here"),
- notice snippets that could be used to solve other problems or provide new ways to solve problems you already solved.
And if you end up copy-pasting your own code, then it may be time to refactor (c.f. DRY principle).
Condor3471928dCopypasting verbatim is a bad thing only if you do it without understanding the contents. I wouldn't say it's bad if you look something up, find that it suits your use case (and already understand what it's gonna do because of that), and then just paste it in. Chances are that you'll need to do some edits though, kneading the code if you will.
For example recently I found on https://forums.whirlpool.net.au/arc... that you can in fact convert internal packets with MTU 1500 to the Wireguard tunnel's MTU 1412. I did have to adjust it a bit to make it use the Wireguard interface and not a PPP one. Understanding the fundamentals of what you're pasting in helps a lot with that. After that you can just reference it for later review, when you need to recall why you did things the way you did.
Root7271728dSerious question: why would you ever copy/paste code? Reimplementing a radix sort?
4. Change syntax / edit variables
mundo03475428dI would think copy lasting something comes with an effort to understand ehat is being copy pasted.
Do that and you will be ok.
I'm confused. Is this about copy-pasting examples without understanding what they mean, or like, refusing to ever copy/paste some boilerplate code and preferring to type the whole thing out every time?
Any devs worth their sort will generally avoid the first one of those like the plague, but almost every dev will do the second, particularly in boilerplate heavy langs.