DEV Community

Discussion on: Explain idempotency (in REST) like I'm Five

Collapse
lpasqualis profile image
Lorenzo Pasqualis

The 5-year-old explanation could be:

You can go to your parents and ask the same thing, in the same way, any number of times.
If nothing else changes, the act of asking something over and over will not change the answer. They won't even get annoyed.

:)

Collapse
alainvanhout profile image
Alain Van Hout

Very nice metaphor. Perhaps a small addition: You can go to your parents and ask the same thing, in the same way, any number of times. If you’re sure they were listening at least once, then you can be sure that they will take care of whatever it is you asked.

Notably, the same might also be true for non-idempotent verbs; the difference is that there you don’t have the guarantee that it will always behave idempotently.