Revisiting (and refactoring) old code

Last week, in a moment of unusual quietness on the work front I decided to go back over some old code (on some personal projects) refactoring —where possible— as I went along whilst generally feeling disgusted with myself at how awful some of that old code was.

As developers, the tools and techniques we use change a lot, often incrementally so that we don’t notice until we have to revisit our own legacy code. When we do look back, it can be quite sobering. Four years ago, when I first wrote this JavaScript and CSS code, I thought it was pretty good, pretty robust… hmm, that’s me being modest because, at the time, I actually thought it was great. Really great. However, upon reflection, it was buggy, overly-reliant upon HTML structure and pretty difficult to whip into shape.

Although it may feel shameful to look back at my CSS code that’s way too over-reliant on IDs and way way way too specific or my JavaScript code that makes JSLint cry, it does show sort of progression. In another four years time, I’ll undoubtedly look back upon the code I’m writing now and be horrified by it too.

Comments are closed.