Chapter 16: Debugging


Debugging and error handling seem like such negative topics. By admitting debugging as a necessary phase of development and error handling as a required practice, we seem to admit to weakness in our abilities as developers. But we are not the computers themselves: we cannot account for all contingencies when we write code. So, to find the error of our ways after the fact, we need a coherent approach to the identification and resolution of defects in our code and a coherent strategy for handling errors in our code as they occur. The process of debugging, therefore, is an integral part of both the development and stabilization phases of software production.

What Is a "Bug"?

You have probably heard errors and defects found in software referred to as "bugs." This word has found its way into our everyday language and reality so that we now seem to regard the bug as normal and inevitable—like death and taxes. However, not many people know how this term actually entered the language.

It happened in the dim, distant technological past when computers occupied whole rooms (if not buildings). On one occasion, technicians were investigating a malfunction on such a computer. Much to their surprise, they found the cause of the circuit malfunction to be a large moth that had been attracted by the heat and glow of the machine's vacuum tubes. Over time, all computer-related errors (particularly the ones that were difficult to explain) came to be known as bugs.

Sometimes we anthropomorphize bugs—give them human attributes. They can seem in turn capricious and malicious, but the bugs we experience in application and database development are not related to mythological folk such as gremlins. Bugs are very real, but their causes are inevitably human. Computers bear no malice toward users or developers, compilers do not play practical jokes, and operating systems are not being stubborn when they refuse to operate as expected. No, when you encounter an error, you can be sure that it was you or another programmer who caused it. What you need to do is find the offending code and fix it, but to find bugs efficiently and painlessly, you need to establish a debugging process—a formal routine with well-defined steps and rules.




Microsoft SQL Server 2005 Stored Procedure Programming in T-SQL &  .NET
Microsoft SQL Server 2005 Stored Procedure Programming in T-SQL & .NET
ISBN: 0072262281
EAN: 2147483647
Year: 2006
Pages: 165

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net