In everyday life
A restaurant can reprint its recipes at any time, like code. The slips that say what each table ordered are state: if they blow off the counter, no recipe brings them back.
One case
A shop’s server keeps every shopping cart in memoryHeld by a running program only. It is gone when the program stops or the machine restarts.. At 03:00 the server restarts for an update. Every cart is now empty. Customers come back to an empty cart, and many of them leave.
Every case
A program holds two kinds of things. Code can be rebuilt from the repo at any time. State exists only where it was saved, and some of it, such as orders, must outlive every restart. A code bug costs you a fix and a redeploy. Lost state costs you the data itself, which is why engineers fear the words “data loss” more than any bug.
The word
Engineers call this
Know where your state lives. Keep the state that must survive somewhere durableSaved somewhere that survives a crash or a restart, such as a disk., and change it with more care than you change code.