“This is the Job”
Whenever I’m refactoring code I’m reminded of Lester Freamon on The Wire. You might be familiar with the quote: “This, right here? This is the job”. (Wilson Miner wrote a nice thought along similar lines on The Pastry Box last year. You should read that, because he sets it up much better than I can. While you’re at it, just (re)watch The Wire. All of it. It just hit Amazon Prime.)
Refactoring is rarely fun, and usually you’re wading into someone else’s code, which is kind of like getting trapped in their subconscious, which is scary. We all get excited when we’re starting out with a fresh, clean project. But web development is very seldom like that. Most days you’re scraping away at old hacks, cursing silently at the person who wrote all this (but wait—it was me all along!) and patching things so that they run just a bit better.
My coworkers and I have been recently joined by a few new folks, and I feel like this is one of the useful pieces of advice I get to offer them. Dealing with old code is the job. Debugging new code is the job. Making peace with that might be one of the things that allows you to keep perspective when you’re elbows-deep in spaghetti code.