Pest Extermination

Weeding out bugs in your software is hard. You have to discover a bug, diagnose the problem, eradicate all traces of the unwanted behavior, make sure the bug hasn’t bred elsewhere, and try not to break the code while you’re doing all of it. The first step alone, finding a fault, is a major hassle: Humans make mistakes when writing, but they make just as many mistakes when reading. When looking over my prose or my code, I’ll naturally read what I meant to write and not what I really wrote. Faulty code isn’t obvious. The compiler isn’t much help; in fact it’s really quite pedantic. It can only produce exactly what you asked, not what you were hoping for.

Some programmers introduce far fewer faults than their peers (up to 60 percent ...

Get Code Craft now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.