The Ultimate Debugging Guide

The Ultimate Debugging Guide

Every competition deserves a dramatic submission just before the deadline 😉

Play this article

Software development is inevitably accompanied by errors. Perfection is unattainable in coding. However, the way we handle errors is crucial to our growth as developers. This article presents a concise guide with practical steps for debugging errors in various programming languages and frameworks. Join me as we explore!

👋About Me

Hi, my name is Sreekesh and I'm a Software Developer and a Content Writer. I've been learning and working with full-stack web development for almost 3 years. I'm a final year undergrad student from the University of Mumbai, India.

In this article, I'll try to change your mindset of approaching errors and problems in your code and working your way towards solutions in a hassle-free manner. I've participated in numerous hackathons and I've explored different ways to debug errors especially when it's a race against time.

🛣️The Approach

We're gonna follow a series of simple steps to find a solution to the error we're facing.

Understanding the Error

NextJS Production build displaying error with code · Discussion #12956 ·  vercel/next.js · GitHub

One of the silliest mistakes people make is blindly copying the error and putting it on the browser or ChatGPT. The key here is to first understand which part of your code is producing the error, what your code was intended to do and which end of the workflow is causing the issue.

Backtracking to the error

console.log("I'm here 1") : r/ProgrammerHumor

When it isn't clear which part of the workflow is causing the issue, you can walk through the code in reverse, i.e. from the final line all the way through to the start. Feel free to make use of console.log or other print statements in your language to log outputs at different stages of your program. This will provide you clarity about the exact lines that are giving you trouble.

Exception Handling

Java Code Daily on Twitter: "Master Yoda is wise in the ways of Java  exception handling. <(-_-)>" / Twitter

Utilize try-catch statements to gain a comprehensive grasp of your program's workflow and guarantee a crystal-clear understanding of potential code-breaking points. By implementing this strategy, you increase code readability and facilitate comprehension for others.

Alt Text

Famously known as Google-ing, the idea is to be efficient at finding things out of Google Search. All you have to do is put your error out on google search and take a look at the results. The chances are, you'll find yourself in a StackOverflow thread, an old GitHub Repository Issue Discussion or literally on the documentation website.

Google-ing doesn't make you any less of a developer. The best developers I know are the ones that use Google the most. Much like any other tools like StackOverflow or ChatGPT, which is where we are heading.

Reading the Documentation

You'll find most solutions related to syntax errors, typos in function names, etc. in the documentation. Sometimes, you miss out on an argument, or there's a typo in the function name and sometimes functions and objects are deprecated by libraries and replaced by other utilities. When you grow as a developer, you'll find yourself interacting more with the documentation and less hobbling around search results.

Taking help from StackOverflow and Chat GPT

The future we have to look forward to with Chat GPT. - r/ProgrammerHumor

StackOverflow is still the holy place where most of your errors will be solved. The knowledge base of that website purely out of support from community members is insanely huge. However, we now have friends from OpenAI that make use of websites like StackOverflow and bring results to us even quicker.

Given how fast ChatGPT is in finding things out, it is a handy tool for debugging. In fact, in a lot of cases, ChatGPT alone could fix your problems. However, I wouldn't recommend this for now, because it doesn't seem to manage versions (it sometimes shares dated/deprecated code) as well as one would expect.

Taking help from Discord Communities

How to Use Discord: A Beginner's Guide | WIRED

Discord has to be my favourite community platform. Most frameworks and tools that I use (like Next.js, Supabase, Flutter and more) have already set up their Discord servers where people talk about the software, and its issues, there are spaces where people can share their errors and more. This is why I feel that you should explore different communities on Discord because they can certainly help you in the debugging process.

Here's Supabase's Discord server for instance. There's a forum channel set up for doubts and issues. You'll have a similar experience with your frameworks as well, the open-source community is very friendly and amazing when it comes to supporting at this level.

🚩Debugging Don'ts

Errors are, in a way, your friends. Because every new error teaches you something, even though you might find them annoying. While you are on the warpath to solve that annoying error, I want you to steer clear of these things that can potentially destroy your learning process.

❌ Ignoring Error Messages

❌ Copy-paste results from StackOverflow or ChatGPT without a second thought.

❌ Deleting Code without clarity.

❌ Not sleeping until you fix the error.

❌ Not documenting the lessons you've learned.

Final Advice

The difference between a Junior and a Senior Developer is the number of errors they've come across.

Enjoy getting new errors. As I mentioned, they are a part of the process and inevitable. Going through this process of debugging is very rewarding and gives you a sense of achievement at the end of the day.

I hope I was able to provide practical and effective steps for debugging errors in various programming languages and frameworks. I hope that this guide will help developers approach errors with a positive outlook and that they will find the solutions they need to create effective and efficient code. Embrace the process, keep learning, and keep growing!

Did you find this article valuable?

Support Sreekesh Iyer by becoming a sponsor. Any amount is appreciated!