Adam Barr has a great post about debugging: Software Engineering Goal: Expose Bugs Faster in which he suggests that the critical task in improving software engineering is decreasing, not the bug count, but the lurkability of bugs.
FoxPro is terrible for lurking bugs. Think of C5 errors. If you have a missing object pointer somewhere, it will generate a C5 error. but not immediately - just later on at some point in time.
Yes, we know about some resolutions to this (Don't Return Inside With), but it's a great example of a lurker.
Which is one of the reasons why tools such as Coverage Profiler and FoxUnit exist - (read Eric Sink's great post about Code Coverage). It's also one of the reasons behind my earlier work on the Code Analyst, as part of VFPX.
I'm getting ready to get started on building further betas on this (Randy Jean had asked me about it at the beginning of last month and I have been too buried to get into it). We've already got a list of some of the more basic checks to find lurking bugs (such as looking for RETURNS inside ENDWITH) as well as more cosmetic ones.
If you haven't seen the earlier versions of it, you can see a little of it in action here.
What tips do you use to catch your lurking bugs?