What is debugging?

The term debugging indicates the activity of identifying the portion of code in which one or more errors (bugs) are detected in software following its use.

The error can be localized during the testing phase of the program; that is when it is still in the development phase and is not yet ready to be used by the end-user, or during the use of the program by the latter. After finding the error, the debugging phase ensues and identifies the software part in which the error lies, which is sometimes very complex.

Nowadays, this activity is supported by specific applications and debuggers, which show the execution to the programmer using step-by-step software instructions, allowing the viewing and analysis of the inputs and outputs of the program itself at the same time.

Before these tools were available for the activity of identifying and correcting errors (and even now, in the absence of them), the simplest (but also least effective) techniques for code inspection were printing a file or printing the instructions on the screen that the program was executing.

Debugging is one of the most important operations for the development of a program. It is often extremely difficult due to the complexity of the software that is being developed. It is even delicate due to the risk of introducing new errors or behaviors that are not in line with those desired in the attempt to correct those for which the activity was undertaken.

Although the task of perfecting software using debugging is unique every time and constitutes a story in itself, some general principles are always applicable. In particular, in the context of software applications, it is possible to recognize the following four debugging phases, summarized in the following diagram:

Debugging phases
Of course, Python offers the developer numerous debugging tools (see https://wiki.python.org/moin/PythonDebuggingTools for a list of Python debuggers). In this chapter, we will consider Winpdb Reborn, rpdb, and pdb.
..................Content has been hidden....................

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