Next

The Case Against TODO

Thomas Guest


Table of Contents

Introduction
What Does TODO Mean?
Ask The Code
Use Cases And Alternatives
Place Holders
Generated Code
Work-in-progress
Notes to Self
Latent Defects
Grand Designs
Future Optimisations
The Hideous Hack
Test Frameworks
The Case Against TODO
Acknowledgements
References

Introduction

TODO, TO_DO, TO DO, @todo, FIXME, FIX_ME, FIX ME, HACK

No other keyword has so many aliases. No other keyword is quite as open to interpretation.

Don't worry, our compiler hasn't gone soft on us. TODO isn't really a keyword: it lives in comments and can therefore take whatever form a programmer chooses, safe in the knowledge it won't cause trouble at compile or run time.

On the surface, TODO seems both useful and inevitable. No piece of code is ever really finished: there will always be something more to do, and where better to record this information than in the code itself? If we think more carefully though, we realise that TODO actually indicates a point at which a decision was made—a decision to defer action, a decision, in fact, to not do something. Clearly this decision is less than ideal.

This article investigates the use of TODO and friends more closely. First, we shall consider what it is meant to mean and what it often turns out to mean. Next, we'll search through some code, uncover some use cases, and think about the alternatives.

These alternatives are usually better. TODO, it turns out, is not so innocent after all. When used as a shorthand for more work required it tells us too little—and often too late—and when used as a convenient label for broken code, it can cause serious damage to a codebase.


Next