Refactoring should be an ongoing process, integrated into the daily development cycle whenever developers notice opportunities to improve the code, especially before adding new features.