A couple of weeks ago, I made an emergency fix to one of the programs I’d written for Toastmasters. And by “emergency fix”, I mean “kludge”. Unsurprisingly, it broke other parts of the code – I found out about the problem yesterday.
I didn’t think my successor would be able to fix my fix (he’s still learning Python, and this was not very clean code, especially after the fix was in), so I told him I’d do it. Instead of hacking at the code and adding yet more special cases, I refactored it to move all of the access to the WordPress calendar into its own module, preserve only those calendar fields we absolutely need (instead of keeping everything around), and in general, cleaned up the code.
It took longer than I’d like, but I think the code is understandable now. I even added comments in a few places!