The biggest problem with some programmers is that they like to fix what isn’t broken. This starts out innocuously enough – a piece of code that works, but isn’t exactly an “ideal” piece of code. Then the programmer starts to fiddle with the code. This is all good and well, unless they take no precautions, i.e. they work on the original code and fail to make a copy of the code. What usually happens is they end up breaking the code. Then they can’t fix it.
I’ll say it again – make a COPY of the code.
If you do want to modify code that already works, consider the following:
- Modify the code so that it has the same functionality, but is shorter or more efficient.
- Modify the code so that it has the same functionality but replaces user-defined code with a built-in functionality.
- Modify the code so that it has the same functionality, but is easier to read and understand.
- Modify the code so that it has the same functionality, but orphaned code has been removed.
Note that modifying code can lead to errors being introduced into the code.