December 15, 2025 at 7:00 pm
No company can afford a highly skilled coder to go around refactoring their code base and shouldn't use an inexperienced coder for the task. When does it make sense to refactor? I can think of a couple of opportunities for refactoring that may make sense. When a piece of code is causing a bottle neck and needs to be fixed or when a feature is being added to existing code since you are going to be modifying the code, anyway. In both cases it is necessary to understand the code and an evaluation needs to be made to determine how much refactoring can be justified. Using your editor to reformat the code to company standards or default standards of the editor is a quick refactor that makes understanding the code easier. If documentation is sparse, the person doing the work needs to document how the current code works as comments in the code because it takes less time and is readily available to the next coder. Then the logic needs to be understood and dependencies identified and documented for the next time modifications are needed. Next the bottle neck needs to be identified and corrected or the new code added. Finally, depending on the skill level of the coder, any obvious bad coding should be identified and evaluated if the time it takes to make the changes are a good investment now or if the refactoring should be delayed to the future.
One thing I'd like to add is if you can't afford to refactor, your company is accepting the risk that the code MAY become unsupportable. What I mean is if you never refactor your code at a minimum for readability and to make it supportable (code comments, documentation, and code formatting), you run the risk of potentially being in a state where bug fixes and feature requests cannot happen as nobody understands how the code works and there is no time budget to give anyone to learn it. Alternately, you could be stuck with legacy code that works but is company risk such as having the code all in VB6 - yes it runs on Windows 11, but can anybody actually support that?
The above is all just my opinion on what you should do.
As with all advice you find on a random internet forum - you shouldn't blindly follow it. Always test on a test server to see if there is negative side effects before making changes to live!
I recommend you NEVER run "random code" you found online on any system you care about UNLESS you understand and can verify the code OR you don't care if the code trashes your system.
December 15, 2025 at 8:59 pm
If your code is under version control and isn’t authorized for change you will have to create a change order to justify the refactor. But if you already have the code checked out, format and document. I know there have been people who come behind me and save time modifying my refactored code.
Viewing 2 posts - 16 through 17 (of 17 total)
You must be logged in to reply to this topic. Login to reply