I've got some software that I wrote around 2 years ago and needs some features added to it.  I've realised that it's in an awful mess, and I have the urge to move everything around, tidy up, etc. I've read the Joel on Software article about not starting again, so whats the best way forward?
What are good approaches to cleaning up old projects?
refactoring;maintenance
You have three basic options:If the app is very small and a real mess, starting again might actuall be your best bet.Refactor.Live with the mess and hack in the additional features.Typically, option (2) is your best bet.How much refactoring you actually do will depend on the resource you put in vs the value you get out. Questions to ask will include:What time / budget is available?How much modification do you anticipate in the future?Who else will see the code? (ie. will messy code damage your reputation?)Is anyone else expected to maintain the code?What refactoring tools are available to help you?What is your experience of refactoring?What experience will you gain from refactoring?What kinds of refactoring will give you the most benefits?What automated tests already exist? Need to be written?How much manual testing will be required?How will you feel if you leave the code as it is?In my experience, it is very easy to get into proper muddle during a refactoring session. The most important lessons that I've learned are to:Do one thing at a time.Take small steps.Make good use of your source control (check in frequently + include comments).Make use of automated refactoring tools.Know the IDE.