“Not Crying Over Old Code”

Monday, 27 Jan 2014

Craig Gidney:

If you join a team that plays a sport you’ve never played before, you can expect to get a “Most Improved” trophy at the end of the year. That’s a good sign… unless you keep getting it every year. […] If you’ve been programming in the same language for half a decade, but still consistently find yourself hating your old code, something is wrong. […] When evaluating how good or bad some code is, it’s important to keep in mind how familiar you are with it. […] Old code will always seem less understandable than you remember, because it’s not as fresh in your mind anymore. Comparing stale old code against fresh new code can create the illusion that you’re constantly improving.

(A seminal moment for me was going back to an old project, fully intent on ripping out a feature in order to simplify and clean up the related part of the code… and finding that I really couldn’t find fault with any of the choices older me had made. It was not at all messy as it had been in my vague recollection. I was left without any changes whatsoever that I still felt compelled to make. I had written good code.)