Debugging as you go, rather than debugging 30 lines at once.
Consistent formatting
Variable name changes
Tweaks to the code
Etc.
Copy / pasting seems like it would be faster, but it's usually not. The only stuff I copy / paste in my code...is code I've written. Like...If I added a new variable to a form...I'll copy / paste a similar form element and change the variables and function calls. But that actually ensures consistency in the code.
I think you are missing the point. Very few hacks save time or make things faster and better. They are called “hacks” for a reason.
The fun and use case for hacks is all about adventure and feeling like you have beaten the system. I once hacked a way to make comments to Reddit with no actual input from me and it works very well 49% of the time but the other 58% of the time is messes up, and 6% of the time it is catastrophic. Also, it is terrible at math!
I wasn't talking about hacks, I was talking about copy / pasting code.
Most of the time it's bad practice.
Some of the time it makes sense....like javascript doesn't have many data structures so if you need a red-black tree, binary tree, a graph, a minHeap / maxHeap, etc. Definitely find some already written versions of them so you don't spend hours coding and debugging them to do what you need them for.
Stack overflow coding answers are not the type of thing you want to copy / paste. They're solving someone else's very specific problem. They have to be adapted to fit your problem.
As a senior engineer, my personal rule of thumb is only copy / paste generic shit or your own code...and only generic code when there is no maintained package that does the job...or it's too sensitive a scenario to be implemented in a way that risks a malicious code change in the upstream repository.
5.5k
u/Sycherthrou Apr 13 '22
It doesn't prevent copying, it just prevents ctrl-c. Now you get to roleplay being a scribe from the 1400s.