Are you SURE that code has no bugs in it?
Published June 6, 2006 by John
Ned Batchelder brought up an interesting piece on “old bugs” that bug Joshua Bloch recently found in, of all things, the classic binary sort algorithm. The standard algorithm that everyone has been using for some fifty years has apparently had a bug waiting to happen. It’s dealing with an edge condition, but that’s where the bulk of code usually ends up being needed, so it really is important for serious users of those edge conditions (in this case: Google).
Something I find just as interesting is Bloch’s own reflection on it.
The general lesson that I take away from this bug is humility: It is hard to write even the smallest piece of code correctly, and our whole world runs on big, complex pieces of code.
In other contexts, that might be a pithy or overly general statement, but with an example so central to computing as binary sort, it’s a sobering reminder to not get too pleased with your rock-solid code.
Filed under Software
Posts