Definition: Idempotent

According to wikipedia.org, “Idempotence is the property of certain operations in mathematics and computer science whereby they can be applied multiple times without changing the result beyond the initial application.”

What is basically means

This is where I usually try to provide a more simplified word for the jargon, but with this,​ I couldn’t. I just had to learn what it meant.

As per the above quote, an action is idempotent when performing an action multiple times on a set has no other effect on that set after the first time it is applied.

That was a bit of a mouthful…The best explanation I could find on this topic is in the following Youtube video by Corey Schafer. It provides an example and shows that if you request the absolute value of 10, then the result of that call is 10. But, no matter how many times you call the absolute value on that same call, it will always result in 10. This is what makes the absolute function idempotent.

It was interesting to see Corey’s explanation of different HTTP methods and how this applies to computing. GET is idempotent as, no matter how many GET calls you make, it won’t change the underlying data itself. Also, calling PUT multiple times won’t change the set any more than the first time you called it.

This is important to note!

POST, however, is not idempotent as it changes the underlying data set,​ and multiple posts will create multiple entries to that set.

DELETE, however, was interesting as it said that if you call DELETE on a certain item multiple times, then it can only be deleted once, meaning that DELETE is idempotent. My thought here is that it must only be idempotent if you’re calling DELETE on a specific term, rather than just calling DELETE on, say, the last entry in the set – this, to me, would not be idempotent.

Attributions:
  1. undefined by undefined