Hurdles and Rewards of Refactoring
Saturday, September 15th, 2007A massive amount of refactoring is currently going on throughout the MapMyGlobe application’s code. As for any project that’s evolving along the way as it’s being developed, some pieces of code end up replicated, or not in the place they should be. I thought I would write a few words about why I find refactoring hard, but why I do it and why a project sometimes really needs it.

I personally find refactoring intrinsically, and almost metaphysically, difficult. At some point in my projects I know I’m going to have to do some, but then my mind is really tormented and I’m really stressed out, and I’m sure this feeling is shared by a fair number of my fellow programmers. First, we’re afraid that refactoring might break a feature that’s currently working, and that’s indeed often the case, but Version control alleviates this problem (assuming you use it, but I think you should, even when you develop solo) because you can always go back and rectify what’s been broken.
But even with Version control, there’s a feeling, conscious or sub-conscious, of non-reversibility of what we’re doing: in most cases, what has been refactored won’t ever retrieve its past form, so we feel like we’re throwing away some stuff, and this thought really scares us. I don’t want to sound squeamish or anything, but our mind can get really tormented. What happens is that both sides of our mind have something to say: while our rational side pleads for some rewriting and reorganization of our past work to increase future productivity, our creative side is scared, because doing so and looking back at what we’ve done before might stop our creative flow. So in the end, it is the same feeling as an artist who’s in a creative phase and who doesn’t want to stop by fear of losing it. And by the way, what’s a programmer, if not an artist? ![]()

