Friday, October 24, 2008

Coding for resiliency : long running (or infinite) loops : stop the madness

....
while(exception instance of MyException) {
    exception = (MyException)exception;
}
....

This was code (not verbatim) that was found in a production application.  Please, always have a valid exit condition for your loops.  And then a 2nd way to exit the loop somehow if the primary condition always reverts to true.