Several good books talk about debugging strategies. I could use this chapter to talk about such strategies in general, but then we couldn't explore the new debugging capabilities in Visual Basic .NET. So, given that choice, I'll discuss the latter. I recommend getting a book devoted to debugging if you don't already own one.
I will give you a piece of general advice: if you want bug-free code, don't write any bugs. This sounds a bit cheeky, but I have found that programmers who write singular, well-named, short methods end up with very few bugs .
A singular method is a method that does one thing. A well-named method uses a name that conveys exactly what the method does; such names usually rely heavily on verbs and nouns. A short method, as I use the term , has less than five lines of code. A good way to write code like this is to refactor, refactor, refactor. If you want to learn more about refactoring Visual Basic .NET, pick up my book Sams Visual Basic .NET Unleashed [Kimmel 2002b] or Refactoring: Improving the Design of Existing Code by Martin Fowler .
There are many debugging features in .NET. Here I will cover as many of those capabilities as I can squeeze into one chapter.