Member-only story
The Good and the Bad of Copy-Paste Programming
There are good and bad sides to each approach.
Every programmer has happened to copy a piece of code from one place to another at some point. The source could have been code previously written by yourself or from some source on the Internet. Those who started to learn to program from books would confidently rewrite the code and see what happened.
When I started programming, I remember having such a book with code examples. A lot of different fragments are ready to be used. It was a helpful position at the time. It was a long time ago, probably around 2005. However, I remember how, thanks to the recipes in the book, I was able to solve the problems I faced quite quickly. The reality today is much different, and the same things can be found on StackOverflow.
However, what helped with learning the language, later on, was repeatedly irritated. Working on large projects and seeing a large code duplication, I even wanted to pull out the C and V keys on the keyboard for people.
But there are good and bad sides to each approach. First, you need to know how to use the available tools responsibly.
Incomprehensible code
Time is often more important than quality. Someone has a problem to solve. He doesn’t know how to get hold of him. She asks Uncle Google for help. He responds with a link to StackOverflow. A ready piece of code there. Quick copy-paste to your own design. Bach works. We’re flying on.
Unfortunately, this is reality. The problem is that the copied code is not always understood by the person who copied it. The application works. The developer does not wonder why it is. The most important thing is the result, not the understanding of the problem. This practice can raise more problems.
Possible mistakes
Code that was posted on StackOverflow or another website could have been written for a specific problem. It wasn’t necessarily the same as the person who later copied it. The code could also be simplified. There may not have been any validation of variables in it. It was meant to show how something can be achieved with ideal parameters. It is known that validation requires writing…