QUESTION
I was reading this question and realized that could almost be me. I am fairly OCD about refactoring someone else's code when I see that I can improve it. For example, if the code contains duplicate methods to do the same thing with nothing more than a single parameter changing, I feel I have to remove all the copy/paste methods and replace it with one generic one.
Is this bad? Should I try and stop? I try not to refactor unless I can actually make improvements to the code performance or readability, or if the person who did the code isn't following our standard naming conventions (I hate expecting a variable to be local because of the naming standard, only to discover it is a global variable which has been incorrectly named)
ANSWER
Refactoring is generally a good idea if it does not interfere with your schedule and does not negatively impact your work. Still, I believe it is a matter of priorities.
The goal is not to write the perfect code.
The goal is to deliver a working product.
The larger a project is, the less chances there are to keep the codebase tidy and perfect. Just accept some imperfection ratio and watch out not to cross it. Minor deviations are okay if they're not potentially dangerous.
Tweet