DEV Community

Stephen Charles Weiss
Stephen Charles Weiss

Posted on • Originally published at stephencharlesweiss.com on

Defining Idempotent

Idempotent is a word that gets thrown out a lot within computing but that I continually forget what it means.From Wordnik, the definition: 1

n. In multiple algebra, a quantity which multiplied into itself gives itself. Ordinary unity is idempotent.

adj. ( computing ) Describing an action which, when performed multiple times, has no further effect on its subject after the first time it is performed.

adj. Said of an element of an algebraic structure (such as a group or semigroup ) with a binary operation : that when the element operates on itself, the result is equal to itself.

So, a subject is considered idempotent if performing an action multiple times has no effect after the first time.

Examples helped solidify my understanding 2:

In mathematics, an idempotent operation is one where f(f(x)) = f(x). For example, the abs() function is idempotent because abs(abs(x)) = abs(x) for all x.

Similarly deletion operations are idempotent because you can’t delete an item multiple times. For example:

target.delete(value)
target.delete(value)

The second delete call will not have any effect on the target since the value it’s trying to delete is not present to be acted upon.

Footnotes

Top comments (0)