What does “Idempotent” mean in software?

I had never heard the word “idempotent” when I started at my first software job. I had a liberal arts education and had been working in nonprofit and school management before my career change. I suspect I’m not alone in this total lack of awareness of the concept! So let’s talk about it.

What does it mean?

It means you can do the same thing with the same inputs any number of times, and it won’t change the end result.

This is easy to achieve when we’re talking about data retrieval — retrieving data doesn’t change the data itself. But it gets a little more complex when we’re talking about running operations on data. In that context, another way to phrase the definition of “idempotent” would be that results are changed only the first time an operation is run, and any subsequent runs of the same operation will have no impact.

Let’s look at some examples of this to make it a bit more clear:

How do we achieve it?

This is where idempotence in software differs from the mathematical concept. Mathematically speaking, idempotence literally means that the same operation is run multiple times without an impact on subsequent runs. In software achieving idempotence usually means building in a mechanism for preventing the operation from being run if it already has.

While all the mechanisms for how to achieve idempotence or detailed walkthroughs of their implementation are out of scope for this post, strategies might include:

Senior Software Engineer | www.adriennedomingus.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store