Chapter 6. TO ERR IS HUMAN

Dealing with the Inevitable— Error Conditions in Code

We know that the only way to avoid error is to detect it, that the only way to detect it is to be free to enquire.

J. Robert Oppenheimer

At some point in life, everyone has this epiphany: The world doesn’t work as you expect it to. My one-year-old friend Tom learned this when climbing a chair four times his size. He expected to get to the top. The actual result surprised him: He ended up under a pile of furniture.

Is the world broken? Is it wrong? No. The world has plodded happily along its way for the last few million years and looks set to continue for the foreseeable future. It’s our expectations that are wrong and need to be adjusted. As they say: Bad things happen, ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.