Open E-School

Friday, February 24, 1984

What is debugging ?

Category: Technology World Date: Tuesday, January 20, 2015

When you are writing code you need to make sure that the code does exactly what it is supposed to do. For example if you are writing a code to add two numbers than it should give you the correct sum of any two numbers you pass to this code. Because writing a code to add two numbers is just a one or two line code it is easy to write and test. But suppose you are writing a program which involves multiple levels of computation and at every level you need to store the results and pass it on to the next step. The code for such kind of programs becomes very complex and it might become a challenge to test this code and make sure that it works properly.

Difference between program debugging and execution

Executing ( or running ) a program and debugging a program are two different concepts. Running a program means that you compile the program and just hit the run button to see the output generate by the code. You have no control over the program while it was running. All you can see is the output of the program in front of you. So after the moment you hit the run button and before your program finishes execution you have no control over what is happening.

Let’s say that after your program finishes all the execution it gives you wrong results. Now what will you do. You will go and look at the code. Let’s say the code for your program is very complex and involves calling many different functions and data is being passed between these functions in a manner that it is difficult for you to just use a pen and a paper to do the computation and see how your program is actually running. This is the point when you need to do debugging. Debugging is different from simply running the program in the way that you have a control on the program during its execution phase. You can stop the program at any line of code, check the values of different variables in the memory at that time, take the code execution back to a previous step and ask it to do that step again and so on. This means that you using the debugging process you can actually slow down the program execution and see how the code is behaving.

Breakpoints are the key

To be able to stop the program during the execution phase you use something called a breakpoint. A breakpoint is an instruction to the system to pause the process of execution at a given line of code. You can put multiple breakpoints in your code depending on how you wish to debug your code.

Rate this article and help us improve

Please Login to rate
Overall ratings: 1 | Rating: 5 out of 5
Previous Article Next Article

Quick Links



Total Followers
Study Group Created
Study Group Joined
Following Teacher
Following Organization
Blog Articles Added
Questions Asked
Questions Answered
Jobs Posted
Total Members in Group
Questions asked by members
Tasks added in this Group

Please wait..


Login to Open ESchool OR Create your account    Login   SignUp