This post is the second in the series of posts about Debugging rules.
Fixing problems without a genuine understanding can create unnecessary difficulties and compromise the program's quality. Thus, it's crucial to comprehend the system thoroughly before attempting any fixes. To achieve this, triangulate the defect by testing scenarios that should reproduce the error and those that shouldn't. Persevere in this process until you grasp the problem well enough to predict its occurrence accurately in every instance.
Read the manual
A functional understanding of the system's intended behavior, design, and sometimes the rationale behind its design is essential. When there is a lack of comprehension in any particular aspect of the system, it often becomes the root cause of issues and problems.
Read everything in depth
Frequently, individuals attempt to debug issues without delving into the system's manual comprehensively. Instead, they tend to skim through it, focusing only on sections they deem significant, inadvertently overlooking the crucial clue hidden in the unexplored section that could have revealed the problem's root cause.
Programming guides and APIs may appear daunting due to their overwhelming nature, but it is essential to delve into them thoroughly. Often, the function that seems easily understandable at first glance can end up causing unexpected issues. Similarly, neglecting certain sections of the schematic may lead to unidentified sources of noise.
Application notes and implementation guides offer a wealth of valuable information, not only about how a system operates but also regarding past issues encountered by others. Warnings about common mistakes prove incredibly beneficial, even if you believe you're likely to make uncommon errors.
Reference designs and sample programs can serve as primary documentation for product usage, but caution is warranted. While they demonstrate one way to employ a product, they might not adhere to good design practices or cater to real-world applications.
Merely adopting a design without fully understanding it may lead to discovering bugs later on. Even the best reference designs might not perfectly align with the unique requirements of your application, potentially resulting in breakdowns.
Know what's reasonable
While exploring a system, having a clear grasp of its typical functioning is crucial. Understanding the standard operations enables you to detect deviations or abnormalities effectively. Many individuals struggle to identify issues simply because they lack a fundamental understanding of how the system is supposed to work.
Know the roadmap
The knowledge about the constituent elements of a system can also give us important insights into the structure of the system.
- Dietrich Dorner, The Logic of Failure
When attempting to locate a hidden bug, it's essential to be familiar with the system's layout and structure. In cases where certain parts of the system are considered "black boxes," meaning their internal workings are unknown, understanding how they should interact with other components helps in identifying whether the issue resides within the box or outside of it.
Understand your tools
Debugging tools serve as your system's eyes and ears, providing valuable insights. To effectively utilize these tools, you must master three essential aspects: selecting the appropriate tool for the task, employing it correctly, and interpreting the results accurately. Additionally, understanding the limitations of your tools is equally important in ensuring efficient and successful debugging processes.
Look up the details
Don't waste your debugging time looking at the wrong stuff
Avoid making assumptions. Instead, take the time to research and retrieve accurate information. Elaborate details have been documented either by you or by the originator of a library, API, or framework. It's unwise to rely solely on your memory.
Engaging in guesswork could lead you down the wrong path, where incorrect information might seem correct. Assuming things may cause you to overlook critical issues. You might encounter perplexing data or, more troublingly, encounter falsely reassuring data.
Emulate Einstein, who never bothered to memorize his own phone number. He would question, "Why should I?" He knew it could be found in the phone book.
Top comments (2)
Great Article! I was experienced some terrible case, and these case waste my lot of time~