TODO or not TODO?
Despite the already very ambitious subtitle of this blog Daily Dose of Software Engineering - and I mean the Daily part -, especially considering my posting habits in the past, I somehow managed to write my second post in just one day! Maybe a good omen…
This one is about a feature of an automatic build process.
We all know, that an automatic build process is a good thing (at least we should know by now). Along with the right tool and plugins, it makes sure that the code always compiles, the unit tests produce a green bar, the coding guidelines are respected by all developers and certain metrics are in a valid range.
Another feature that should be used much more often is, that pending implementation tasks (those nice TODO comments that a developer can put into his code if he is not really done yet) can easily be managed. Developers are usually very diligent adding such comments (mostly to defer dull or complicated tasks for later), and build tools have very good support for creating lists of those TODOs.
The problem is usually, that those comments are added to the code, the task lists are created, uploaded to the project’s developer web site, and … well, stay there without ever being checked (in the hot phase of a project, which is usually always, nobody wants to find some more skeletons in the project’s closet).
Here are some ideas that might help prevent this problem:
- If you don’t do that already, add those TODO comments whenever you defer some implementation task for later, and use your build tool to create a publically available list of those implementation tasks
- Before a release, the developers are responsible for checking their tasks, if they are relevant to this release (note, that you need to know, which tasks belong to which developer) and complete them if necessary (and then of course remove the TODO tags)
If these simple rules are obeyed, chances are small that your test team finds a bug, the developer looks for a possible fix, just finding a TODO comment saying exactly what should have been done in the first place to prevent this bug.
Finally, just a little story about a TODO comment we found some time ago - it was something like
/* * TODO change this by version 5.3 */
Well, believe it or not, we found it while adding some features for version 5.8
.
So back to our question TODO or not TODO? - the answer is definitely TODO!