Debugging – 4 tips to save the day.

Debugging – 4 tips to save the day.

When in the industry of software development, whether your title is programmer, engineer, architect, or master of the universe, you’ll eventually face issues that require debugging skills.

Honestly, debugging skills refer to the expertise of tracking down where, why, and how to fix a problem before or after it’s become an issue.

Disclaimer: This is a re-post of an article I wrote early this year, but this is the first time sharing it. The link to the original article may be found at the bottom of this post.

Debugging, in the context of this post, may be a technical term for the technology world, but, it’s a part of problem solving to ensure the proper working results of a tool, object, feature, or <insert some object or creation here>.

For those of you looking to improve upon your debugging skills, I strongly recommend reading through issues posted on StackOverflow, and taking the time to read some of the great programming books. 

Great list of programming books can be found here: The 9 Best Programming Books to Read Right Now if You Want to Distinguish Yourself

Gaining more knowledge about programming will help you write better code by considering coding techniques to reduce the bugs introduced to your code.

Now, here are 4 tips for Debugging:

  1. Reproduce the issue! I can’t emphasize enough how important it is to note how a bug occurred so to reproduce the problem. If you can’t reproduce the issue, then it can be extremely difficult to track down the issue and find a solution.
  2. Print Statements. Print Debugging (or tracing) is one of the most common ways to debug problems. Using print statements, you watch as your statements print during runtime to determine execution flow of the process and to track objects throughout the code. Print Debugging is usually a quick go to for finding a NullReferenceException or to discover logical errors effecting objects at runtime.
for (int i = 1; i <= symbols.length; i++)
{
   Console.WriteLine("Executing Loop"); // print statement example
    if (i == 1)
   {
      Console.Write("i = 1");
    }
    else if (i > 1 && i < 11 && i != 6)
    {
      Console.Write("Other i states"); // print statement example

    }
 }
 Console.WriteLine("For loop complete"); // print statement example

  1. Use the Call Stack. The Call Stack is literally a stack of information about active subroutines of a program. It’s also called an execution stack, control stack, run-time stack, or just “the stack”. Use the stack to track executions of subroutines and in turn find the subroutine that was executed when the problem your debugging occurred. In software like Visual Studio, when running in debug you’ll likely have access to the stack if a runtime crash occurs and the execution pauses. If the call stack is not already open, then look in the menus for Debug > Windows > Call Stack.
  2. Logs. When running a production or release application, you’ll likely not have accessible debugging tools. This is where you print problem occurrences into a log, use memory dump, or actively track issues seen while interacting with the application.

In the end, debugging is a skill learned by facing issues that require fixing. To improve your debugging skills and reduce the bugs introduced to your code, I think the most important thing to do is better understand fundamentals like memory manipulation and management, data structures, and algorithms.

There is a reason that these fundamentals usually make up the core of interview questions at almost all technology companies.

I would also recommend developing the grit to get through the rough times where you’ll be trying to solve a bug for days, weeks, months.

Remember, though, there is a lot of support out there. If you don’t have someone to discuss programming problems with at work, then seek out someone externally through forums and groups. You may also feel free to reach out to me here on Journey to Programming.

Send me a message or Ask a Question

The original article may be found here

To view or add a comment, sign in

More articles by Eissa Jamil

Insights from the community

Others also viewed

Explore topics