Mindset For Debugging (And Why We Need It)

When it comes to writing software, maintaining software, or simply trying to understand software, a debugger is one of the most powerful tools that we can use.

But when it comes to WordPress, it seems that it’s less common. Personally, I’m not sure why:

  • I don’t know if it has to do with the nature of open-source,
  • if has to do with the convenience of echo and var_dump that are built into the language,
  • or if I’m just missing other developers who talk about it.

Regardless, if an IDE doesn’t have a built-in debugger, it’s not too difficult to set up Xdebug and get started using it. And once you do start using it, you learn much more about how a given piece of software performs regardless of if you wrote it or if someone else wrote it.

Yes, I’ve written on this topic before, but I recently stumbled across an article that I found to be a really good break down of how to shift one’s thinking into a mindset for debugging.

A Mindset For Debugging

This is going to sound a bit like a book review or a cliff notes version of someone’s work. That’s because it’s supposed to and I’ll cover why later in the article.

Mindset For Debugging

So here’s the gist: In The Debugging Mindset, the author covers about eight points about debugging and intelligence. I think all of them are relevant and worth a read, but I won’t cover them all here.

Instead, the ones I think worth highlighting and at least briefly touching on are:

  • Debugging is Inherently Difficult. “Bugs occur when have assumed correctness in their implementations and by definition do not know where they went wrong. The only way programmers can hope to solve such bugs is through knowledge acquisition.”
  • Teaching Debugging Skills. “Those most effective at debugging draw from extensive experience, as well as refined problem-solving skills. They also employ generalized strategies for problem-solving instead of treating every individual bug as a new, specific case.”
  • A Note on Tools and Environments. “Since bugs occur because of an incomplete mental model, the philosophy of relying entirely on tools, runtime environments, and languages to catch bugs seems self-defeating. It’s almost as if we are saying that we can’t possibly be smart enough to understand these bugs, so why even bother?”

Clearly, there’s a lot of psychology to debugging. But if this research exists around this particular topic in computer science, why aren’t those of us who are programming on a daily basis employing any of this?

We can get better at what we’re doing through practice and by using some of the material mentioned in the article.

A Post on Someone Else’s Article?

Why write an entire post about someone else’s article? I know. It’s not something I regularly do, but this is a bit different.

First, it’s one thing to share it on Twitter but those types of shares go flying by when someone else shares a thought.

Secondly, if an article feels too long to read at a given time, it might be overlooked. And when that happens to really good material – especially when it’s something that I think could benefit those who are working in our industry – then I think it’s worth sharing.

And, as I stated at the beginning of this post, developing a mindset for debugging is key. In my experience, it comes after you’re used to using a debugger long enough.

In short, you start to think like the debugger.

But if you’re able to shortcut that particular step by even a little bit, why wouldn’t you? And that’s what I think is great about the aforementioned article: It presents the information on a mindset of debugging well enough such that those who use it prior to using a debugger may be better prepared for it.

Above all else, though, it’s far more productive, useful, and powerful to use a debugger than some of a language’s built-in facilities for examining data structures.

And I’d think it’s important to share that with those of us working in WordPress.