'Bugs' in computer programming are behaviors from a program that are unexpected and harmful. They vary in severity, and could be anything from strange formatting to a total system crash, so it is important to eradicate them. 'Debugging' is the process of going through a program's code and using extensive test cases to find and fix as many bugs as possible. Bugs can be extremely subtle, or situationally specific and so it is not uncommon for some to persist even beyond the launch and distribution of even the most popular software, requiring the publishers to send out patches and updates for their software.
Programmers have been around long enough to turn debugging into something of a science. Inevitably, the fix will be highly specific to its own particular environment but the initial steps in debugging have become rather methodical. They are as follows:
- Reproduce the problem - this can be a huge task in itself as the bug may depend on the user's own system and set-up
- Strip away the input needed to reproduce the problem until it no longer occurs, then replace the last thing you stripped away - in this step, you are finding the simplest test case that will produce the bug
- Break the bug down into parts as much as possible and attack them individually - the 'divide and conquer' approach
- Get input from a friend or colleague - a pair of fresh eyes can be essential when you've been starting at the same ten lines of code for two days
Thankfully, there are a wide range of tools available to aid a programmer in debugging. Benchmarks can be used to isolate exactly when during run-time problems begin, memory management debuggers may search out memory leaks, etc. With high-level languages like Java and Python these may not be as necessary as their structuring makes it easier to spot anomalies simply by stepping through the sourcecode. However, lower-level languages like C and especially anything in an assembly language will require more tools to spot their 'silent' or 'invisible' bugs. These kinds of bugs are most commonly caused by memory corruption.
Designated debugging unit for developers of Xbox [Photo credit Evan-Amos]
The more interdependence in a system, the harder it is to debug a part of it without serious repercussions rippling through the rest of it. In other cases, large-scale updates often annoy users to the point that it is better to leave them with the knowledge of how to navigate an existing problem than fix it. When debugging, one must always weigh the benefit and the risk.© BrainMass Inc. brainmass.com August 12, 2020, 9:17 am ad1c9bdddf