1 Managing code quality
This chapter covers
- Various techniques to improve the quality of your code
- Advantages and disadvantages of static analysis
- Approaches to make static analysis more useful
- Testing and assertions
Every software developer introduces bugs to the code—there’s no way to avoid them completely. Some bugs cause very subtle changes to a program’s behavior no user would reasonably care about. However, other bugs are much more severe and, depending on the project, could lead to millions of dollars in loss, a destroyed spacecraft, or even the loss of human lives. Most bugs fall somewhere in the middle: they don’t have disastrous effects, but they annoy users and require hours of debugging and fixing.
Some bugs are caused by a misunderstanding of the specification requirements, a miscommunication between the software development team and the customer, or a similar human error. Other bugs are created by a miscommunication between the developer and the machine. That is, the developer correctly understands the problem but writes the wrong code, so the machine solves the problem incorrectly. This book is devoted to this second category.