When your code gets too muddy…

I’m about to do a .. (not a refactoring)… more than that.. more of a rewriting… of an application I’m working on. The application is about 85% complete (conceptually) .. (not an exact figure)… thing is I’ve being working on it for the last 6-odd weeks and I’m not working to any particular specification or design. Back then (seems like ages ago)… I didn’t have a clue what this application would *be*. Now that I know (pretty much) what it is, and have written 85% of it. And at the moment the codebase is in a mess… I feel the time is ripe for me to rewrite this software.

The way I plan to do this is: for each and every one of my source files (eg. foo.bar), I will make a blank file beside it called “foo2.bar”. Blank. Once this is done, I’ll go through them 1-by-1 and evaluate each source file , re-familiarize myself  with it and compare the version that’s in my brain with the actual version, and remove any extraneous stuff that’s in the source file, and copy the rest into the *2.* file. This will not be on a per-class basis, nor on a per-function basis, it will be on a more ad-hoc basis. This will improve my conceptual view of the application, hopefully allow me to strip out lots and lots of unneeded code and vastly simplify the codebase, and allow me to change some of the implementation (NOT adding/removing features). At the moment the features I want are there and there are no unwanted features.

When I’ve done this with all the source files and hopefully the version of the application that’s in my head will be much clearer and have far less lines of code, I’ll be in a good position to get it to 100% and complete.

Advertisement