The easiest code to write is the code that is already written. If you can reuse existing code, it is always better than writing new code. You don’t have to spend time writing the code, and if the existing code has been around for a while there is a good chance that it is well tested and thus more likely to be correct than the new code you introduce. So your aim as a programmer should be to write as little new code as possible, paradoxical as it sounds.
The way to reuse code, however, is not to copy chunks of existing code from one place in your program and paste it into another. You ...