Sketchplanations

Get my new weekly sketch in your inbox

Join over 30,000 people learning something new in a moment each Sunday.

Idempotence, or idempotent, illustrated with an idempotent action of look_at_cake that always has the same effect, compared with a non-idempotent action of eat_slice_of_cake

Idempotence

Idempotence is essentially an operation that, no matter how many times you do it, you’ll still get the same result, at least without doing other operations in between. A classic example would be view_your_bank_balance being idempotent, and withdraw_1000 not being idempotent. It’s a property that’s often handy as you can retry the operation without worrying about unintended effects.

Idempotence is a concept from mathematics and computer science but can be applied more generally. For example, simple on and off buttons are idempotent, a property that can be very useful in emergencies.

You’re welcome to use and share this image and text for non-commercial purposes with attribution. Go wild!
See licence

Buy Me A Coffee