code q&a
Resources About
Question:

What is debugging?

Debugging is figuring out why your code isn’t doing what you expected and then fixing it. Maybe you click a button and nothing happens, or your app shows the wrong total at checkout. The mistake in the code behind a problem like that is called a bug.

The most famous bug story is from 1947, when engineers working on the Harvard Mark II computer with Grace Hopper found a real moth stuck in a relay and taped it into the logbook as the “first actual case of bug being found.” Engineers had called glitches “bugs” long before that (Thomas Edison used the word in the 1870s), so the note is famous because this time the bug was a real one.

Most debugging follows the same steps. First you figure out how to make the problem happen again on purpose, which is called reproduction. Then you read the error message in your terminal or browser, along with the stack trace, which is the list of function calls that led to the crash. You can also add print statements like console.log in JavaScript to see what your values are at each step. You keep narrowing it down until you find the line that’s wrong. The last step is fixing that line and running the code again to check it stays fixed.

A debugger is a tool, usually built into your IDE, that lets you pause your code while it runs and look at what’s going on inside. AI coding agents like Claude Code can do a lot of debugging for you by reading errors, adding print statements and running the code themselves.

I remember first seeing the term “debugger” in the QBasic editor on Windows 3.1. QBasic was the first language I learned to code in. I didn’t know what it meant at the time but I’ve used debuggers extensively within IDEs since then. I don’t use them as much because I’ve stopped writing code by hand. But they’re always useful for diagnosing runtime issues, which are bugs that only show up while the code is running and are hard to infer just by reading it.

You might also like