Early Termination
by in CodeSOD on 2007-05-21Once, I asked a coworker for a feature request. His service was outputting hashes and I wanted the original strings. His reply was that if I had an algorithm to reverse a hash --- all that this service stored and obviously impossible --- he'd implement my feature. My suggestion was that he record an input-to-hash mapping and just reverse that. The feature was checked in that day; perspective makes all the difference. My next feature request was that he set up a signal handler to catch signal nine, as he had attached cleanup routines to several other signals. I guess he spent the rest of the day trying to figure out why it wasn't working.
And I guess that's the point: for many things there is an obvious solution, for some things there is no solution, and wisdom is knowing the difference. The problem is second-guessing things that cannot occur, especially when you guess wrong. One of our field agents, Paul, recently had a run in with murderous #9; he writes,
'We once bought some code from a large company who shall remain nameless. Security was the big issue, so a programmer came up with the not-so-bright idea of how to be sure that a small utility program would really exit and not somehow keep running.