TODO: Fix the TODOs
One of the apps I work on contained 29 TODO comments. This is a problem because with so many loose ends lingering on in the code, newly introduced TODOs simply get lost in the noise and never get fixed. In fact, some of those 29 TODOs dated back to 2005.
So this afternoon, two of us decided to take a look at each of those 29 issues. We found a room with a projector, fired up IDEA, and analyzed every TODO. In about an hour, we eliminated almost every issue. We generated change requests for each of the remaining 5 or so TODOs, and will fix those tomorrow.
I am simply amazed we never got around to doing this sooner. We’ve been looking at this noise for years now, and it ended up taking an hour to eliminate most of the problems. It might take another few hours tomorrow for the “hard cases”, but that’s time well spent.
Next up? I think we have some nagging errors in the application server log files. These bogus errors, warnings, and overly chatty log statements must all die.
Advice
- Don’t let your TODOs, broken tests, and cluttered log files fester. Resolve the problems as soon as possible. (for the record, our tests always pass 100% on this project)
- Once you get to a clean slate, keep it clean. TODOs are fine for quick fixes and temporary workarounds, but make a concerted effort to resolve the TODOs as soon as possible. A lot of small, minor improvements are easier to deal with than one massive cleanup effort down the road.
- Noise masks true problems. If your IDE and log files flood you with false warnings, you will fail to notice really important issues.
I’m about at the point where I’m willing to forbid we use TODO comments at all. There’s nothing worse than running across a TODO that no longer makes sense, or worse it’s been fixed, but the TODO for it remains. I’d like to state, either do it right the first time, and skip the TODO or don’t change the code. Too draconian, I’m sure, with production point releases and “quick fixes” going out all too often. Your scenario is a rare one. In my experience, I’ve never heard of it being done before. We’ve never even considered pulling the code aside and fixing our tech debt in one fell swoop. Too bad for us.