The Art of Debugging: Basics

Pranjal Goyal
3 min readMar 23, 2022

--

Are you tired of writing print statements to debug applications? Don't Worry I Got You…

In small applications which is managed by 2–3 peoples, it can be easy to debug your application by using just print statements.

But as you move on to production-level applications, it might be difficult to put print statements everywhere and it requires a lot of extra code writing. Therefore debugging knowledge can help you stir the boat faster.

Almost all IDE has the same debugging features, to start debugging just run your app in debug mode (by clicking 🕷).

Coding is ♥

Terminologies and their meaning:

Break-Points:

It is a red-point where your debugger will pause the execution of the code. It can help us to determine the state of variables as well as the function calls that are executing till that point.

To activate a break-point just click on the right of the line number as shown in the image.

BreakPoint

But the question is where to put my debug point??…
Let's say that your delete function is not working as expected, so it is better to start putting a debug point where the function is written.

Defining Condition:

You can also define custom definition at a breakpoint which will pause execution if the condition matches.
To define a condition just left click on the mouse and enter the desired condition.

Example: If the todo task is “Buy Books” then only pause at this breakpoint.

Debugging Controls and Window:

Debugger Controls and Window
  • Frames:
    The frames help us to keep track of various function calls that are executed till now. It helps in navigating between in call stacks.
  • Variable Section:
    The variable section displays all the available variables in the current context. It helps in analyzing the program as well as you can modify it.
  • Step Over:
    It takes you to the next line of code from the current line. If the current line has implementations it will implement it and will move to the next line of code.
  • Step Into:
    It helps in showing the implementation of the method of the current line of code.
  • Step Out:
    It takes us back to the caller method by skipping out the current implementation of the function.
  • Drop Frame:
    As the name suggests it undo the last frame and restores it to the previous frame in the stack.
  • Evaluate Expression:
    The evaluate expression helps us in evaluating any expression in the code. Even mathematical expressions :).

This is just a basic tutorial for debugging applications. There are a lot more features a debugger provides that you can explore.
Hoping you have gained some knowledge by reading this article.

Till next time keep exploring keep learning…

Connect with me:

Wanna talk about something let's connect?
Linkedin | Twitter | Github

--

--

Pranjal Goyal

Coding is ❤ | Computer Graduate | Learning New Things Everyday… | I write good stuff