In everyday life
Like a passport check at the border. Each traveller is checked once, on the way in; nobody asks for the passport again at every café.
One case
A booking site’s form lets a user type the number of guests. Nothing checks the number on the way in. A user types -1, and the price code multiplies the $120 nightly price by it and saves a booking with a total of -$120.
Check data once, where it enters the system from outside, and turn it into a clean, known shape. Code inside can then trust it.
Every case
Outside data is wrong in endless ways: blank, too long, the wrong type, or made on purpose to cause harm. If nothing checks it at the boundaryThe edge of your system, where data comes in from outside: a form, a file, another company’s API., each function inside must guess whether to check it, and some will not. The checks that do exist get scattered and repeated, and still miss a path. Check once where the data crosses in, and turn it into a typed value that cannot hold a bad case. Past that point, code trusts it.
The word
Engineers call this
Check outside data once, at the door, and turn it into a clean type. Inside, trust it.