Code refactoring is essential as software systems are used and improved upon. New requirements, use cases, and technologies will invariably force a development team to refactor applications and components in order to meet the goals of performance, maintainability, test-ability, separation of concerns, and so on.
But how do we as developers plan for this? Do we set aside dedicated time just for refactoring? Do we sneak it in along with our ongoing projects? Either approach can work. If it becomes apparent that upcoming large projects require existing code to be refactored, it’s best to plan to complete the refactoring prior to the project kickoff. Otherwise, if the desired refactoring is small, it can usually be accomplished in stream of ongoing projects.