How to Minimize Bugs
How to minimize bugs
With the project properly organized and the requirements clearly understood (whether for the whole project or only for this iteration), design and coding can start. Of course, coding presents not only the opportunity to create great new features, but also the risk that the programmer will create great big bugs. To mitigate this risk, there are three things every programmer should do with every piece of code written:
1. Unit testing
The programmer should test every line of code, every branch, every condition and every loop. Higher levels of testing, such as system test, often touch half or less of the code-and any untested code is a potential hiding place for bugs. New tools, both commercial and freeware, make the job of unit testing much easier than it was in the past.
2. Static analysis
Even code that passes unit tests can still contain latent defects, maintainability problems and security vulnerabilities. Static analysis can cheaply and quickly find bugs that would take hours to find and remove during higher levels of testing. The programmer now has a wide variety of tools available to help with this task as well.
3. Code review
Once a given unit of code is written, tested and analyzed, having a walk-through or technical review of the code among the programming team is a great way to catch most of the remaining bugs, as well as ensure good understanding of how the program works across the entire team. Studies show that as few as three experienced programmers, following a rigorous inspection process, can find as many as 90 percent of remaining bugs.
We can be very confident indeed in each unit of code, if programmers go through these three steps prior to checking their code into the source code repository.