DEV Community

Cover image for Idempotency in 256 characters or less
Lucy Linder
Lucy Linder

Posted on

Idempotency in 256 characters or less

This is a submission for DEV Computer Science Challenge v24.06.12: One Byte Explainer.

Explainer

Borrowed from Mathematics, an idempotent operation can run multiple times without changing the result. Writing to a file is idempotent, but appending to a file is not. A script using idempotent operations can thus fail midway and be restarted safely.

Additional Context

This idempotency concept is so important, yet too often unknown. It is the magic behind famous tools such as Terraform, Ansible, Kubernetes Manifests, etc. Fault-tolerant REST APIs are mostly idempotent REST APIs. It is everywhere, yet cleverly hidden. It is what makes operations repeatable and consistent.

There are better explanations online, but if my submission makes at least one person curious about this concept and want to know more, then I won already 🙂 !

Top comments (0)