Idempotent operation

Idempotent Operation

idempotent: unchanged when multiplied by itself.

That is, if you run the same process multiple times, the last state won’t change.

If we consider this word in the scope of programming, an idempotent operation is one which performs the same effect, but if it’s already at the end state then it does nothing. This operation is repeatable, and if we run it once again, it doesn’t continue to perform the same operation.

For example, creating directories in the command line is an idempotent operation. It will create the file once, after the first try it won’t create the same file again. Similar, if we delete a folder with rm -rf <file-name> command, it won’t perform the same operation in the second try and beyond.

Source

Leave a Reply

Your email address will not be published. Required fields are marked *