Chapter 3. Debugging Strategies

DEBUGGING WEB APPLICATIONS IS AN ART very much like warfare. Before entering into a battle, you create a plan of attack and then execute it to defeat your enemy. Few would consider such an engagement without a plan—thoughts of doing so conjure up images of soldiers blindly running at the enemy and throwing themselves into the path of gunfire.Yet, many developers attempt to engage in a debugging battle without any such plan or method.

Debugging under these circumstances might consist of randomly attempting different things, in vain hope that one of them (or a random combination of them) will solve the problem. Although sometimes this works (hey, somebody wins the lottery), it all too often leads to long, frustrating hours yielding little, if any, meaningful progress. Even a slightly more intuitive approach, such as basing your debugging efforts on past experiences, falls short of the ideal. This is because working with newer technologies reduces the effectiveness of the experience factor. We need more than a collection of memorized “fixes” to problems. We need a complete process to track down and eliminate bugs in code.

In this chapter, we introduce some tried-and-true methods for debugging web applications. These methods link together to form a complete approach to narrowing and eliminating those hard-to-find problems. They all aim to reduce the amount of time required to find bugs in code. The chapter is oriented more toward overall methodology than technical implementation, so we will keep the examples simple. We will demonstrate more complex examples of each of these methods, as well as the overall approach, throughout the book as we go into more detail on debugging specific parts of ASP.NET. We will be sure to mention which method or methods we are using so that you can keep track of them. Note also that the following methods are designed mostly to track down semantic errors. These are runtime or logic errors. Syntax or compile-time errors will be discussed in the context of each technology covered in the following chapters.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset