Checking your account

You can read the lesson while its saved answers and constructions load. Learning controls will open once that work is ready.

Fail Fast, Fail Early

Early Failure and Partial Updates

BOTIE

Programs can continue running after a mistake while producing increasingly difficult consequences. The Pragmatic Programmer discusses contracts and early failure as ways of stopping that spread. The useful idea is to expose a broken assumption close to where it first becomes visible.

Python gives us explicit exceptions for that decision. A function can reject an unsuitable value before using it, while a caller can handle the failures it expects. Our batch example adds another requirement: validate every incoming measurement before changing the saved list. An early error message alone would not repair a partial write.

Sources for this history