Chapter 6 of 10All chapters
Chapter 6 of 10
Reading for trouble
Where bugs like to hide.
The usual places
Boundaries: the first and last item, empty input, zero, null, and the moment a limit is reached. Most bugs live at an edge rather than in the middle of a happy path.
- Off-by-one errors cluster around <= against < in loop conditions.
- Error paths are the least tested code in almost every codebase.
Concurrency
Anything touching shared state from two places at once deserves suspicion. Timing bugs read perfectly well on the page, which is what makes them expensive.