[Digg] The N habits of highly defective windows programs.
Generally, when I get a program from a client who is having problems, I can solve most of the problems by looking for the items I describe here. My track record is that I have been shown code on a page, or on a screen, containing one or more of the techniques I discuss here, and I point to it and say "There's your problem!", usually within the first 30 seconds. It sometimes takes another ten or twenty minutes to explain to the programmer what has gone wrong as a consequence, and demonstrate exactly what can go wrong in the future, but thus far I've never been wrong in my assessment. On one recent consulting trip, I spotted a Sleep() inside a WaitFor..., and said "there's the problem", and then explained "Your program will fail under the following conditions (a), (b), (c) and the behavior it will exhibit on failure will be (d), (e) and (f)" and they said "Yes, that's exactly where and how it is failing!". As it turned out, there was nothing wrong with that part of the program that a complete rewrite wouldn't solve.