Debugging is a critical skill for software developers. More important than the skill is the mindset. The debugger’s mindset is the attitude that you must always understand the “why” behind a problem; any ambiguities or unknowns are unacceptable. This mindset has the potential to carry you from debugging small functions to solving difficult organizational issues.
The Virtuous Cycle Of Debugging and Understanding
There is a virtuous cycle between debugging a program and understanding a program. 95% of time, you’ll be contributing to a pre-existing system. It’s rare to work on a codebase (outside side-projects) that you have completely written from scratch. In order to make coherent changes to a repository with a long history and numerous authors, you need put in work to understand the system.
A tried and true way of expanding your understanding is through debugging. Every time you squash a bug, you understand the system a little better. Once you understand the system a little better, you are empowered to debug larger issues. Once you solve larger issues, you begin to understand the deep nuances of the software. This creates a virtuous cycle where both your debugging skills and your comprehension build on each other.
This virtuous cycle is the only option you have. If you fail to debug a small issue, you have failed to understand a scoped area of the code. Without a basic understanding of the system, you’ll lack the support structures you need to build any further understanding. As the code evolves, you will find it harder and harder to both debug and grok the software.
Be Scientific About It
Debugging is a science. It’s not guessing. It’s not throwing log statements in random locations. To debug effectively, you must have a method. Your actions must be deliberate, your hypotheses must be proven (or disproven), and you must conclusively arrive at solutions.
If you work alongside experienced developers, you may get the impression that they can easily and naturally debug any issue. You may feel that they work by intuition rather than science. It may be difficult to pinpoint their method; they always seem to gravitate towards the correct solution. How can this be?
This “intuition” is actually just experience. As you put years of coding under your belt, you will begin to leverage past experiences to find heuristics in debugging. You’ll see the same problem manifest itself across many projects. This intuition is the culmination of years spent methodically squashing bugs.
Debugging Has Its Own Scope
Debugging a bug in application code is very different than debugging a complicated distributed system. Similar to your projects and work, debugging has varying degrees of scope.
When you first start debugging, you will begin by fixing issues in code local to your domain. This might be checking for an extra edge case or preventing a particular runtime exception. If you’re doing this on a regular basis, it won’t be long before you start debugging larger and larger issues.
As you gain more experience, you will begin to compartmentalize information. You’ll move specific modules into black boxes, each with their specific inputs and outputs. You will begin to focus on interfaces and integrations. You will skim through implementations, only taking a deeper look out of curiosity.
With a growing level of mental organization, the scope of your debugging abilities will increase. You’ll be able to consistently perform process of elimination across a variety of possibilities. You’ll be able to quickly isolate issues to specific modules. Most importantly, you’ll be able to offer robust, practical solutions for the system.
Debugging across varying scopes does not mean you only get to debug large-scale issues as you become more experienced. You must be ready to debug any issue, whether that be an edge case in a complicated distributed protocol or a couple faulty lines of code.
Debugging Skills Extend into Organization Problems
Debugging skills extend to many different domains. A debugger’s mindset can give you a more sophisticated product sense, assist you with managerial duties, and even enable you to improve business outcomes. No matter which direction you decide to steer your career, debugging is critical.
For example, if you go down the engineering manager’s path, there will be times where you need to debug a dysfunctional team. Similar to a software defect, you must be scientific and diagnose why the team isn’t operating well. The project might be lacking adequate product specification, or perhaps two team members are butting heads. As an engineering manager, you will need to debug organizational issue with the same attitude that you handle software bugs. This means attend extra meetings, reading through contentious code reviews, or taking the extra time to speak with engineers. It’s a different kind of debugging, but it’s still debugging.
The debugger’s mindset is crucial. You must always understand the “why” behind any problem; anything less is unacceptable. This mindset will enable you to solve a variety of problems, constantly reinforce your understanding, and allow you to implement robust solutions. As for your career, your attitude towards debugging will assist you from debugging edge cases in functions, to analyzing nuanced system failures, to fixing organizational inefficiencies.