It is that time when the adding of new features and cool ideas has to be brought to a halt before the code becomes too tangled to ever untangle. The time when unnecessary files no longer containing useful code clutter up the source directories. When major files creep up past the 500 LOC mark, when some source directories have more than a dozen or so lua files. All indicators that a bit of house cleaning and reorganization is overdue.
A few tips and tricks I've found useful:
Searching for names in files: grep - on linux its easy, on windows WinGrep is handy.
Tortoise Hg (source version control), right click context on windows and select rename to move files around.
Break the process into steps and commit each step so if you screw up you can easily backtrack.
Look at chunks of code that do similar things and see if you can't extract out a reusable chunk.
I'd like to hear your refactoring experiences, good and bad, as well as any tips or tricks you may have discovered.
A tip: Last one I did was when I went through all my "constants". In sublime you can ctrl-shift-f, then search whatever term. It'll show you every single spot in your project that that term shows up -> very easy to find unused variables.
When I did a project rewrite, I found using version control extremely annoying, mostly for the fact during most of it, it wouldn't even compile. I didn't like the idea of committing broken code.
MPQC wrote:
When I did a project rewrite, I found using version control extremely annoying, mostly for the fact during most of it, it wouldn't even compile. I didn't like the idea of committing broken code.
In a case like this, I would create an unstable branch called rewrite, and merge it in with the main branch when it is completed.