cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
636
Views
3
Helpful
2
Replies

Word of the Week: Idempotent

atacke
Cisco Employee
Cisco Employee

When something is idempotent in programming, what does that mean?

Based on the mathematical definition, we can infer how idempotent characteristics have found their way into programming and technology in general.

Idempotency means that when something is run, executed, or applied multiple times (given the same input parameters), the same output results. Just as we expect 9 x 3 to always equal 27, we should write code that produces a similar, static result when needed.

This is an important notion to remember whether we are creating functions that may be retried automatically or tearing down and rebuilding infrastructure in a programmatic way. The way we write code needs to consider edge cases that may change the outcome (should something be run more than once), and ensure that regardless of the number of times something is run, the end result is as if it had only been run once!

Got any weird edge cases you'd like to share that resulted because of a lack of idempotence? Share them below!

2 Replies 2

davidn#
Cisco Employee
Cisco Employee

I am sure that many of us had experienced lack of idempotence one way or another during our professional life.  For me rolling out database changes to production and found out that I had to roll back those changes can be quite a challenge.

Ansible, an open-source automation tool, promotes idempotence as a fundamental principle. Ansible playbooks, which define the automation tasks and configurations, are designed to be idempotent. It is one of the key factors that make Ansible a powerful tool for infrastructure and configuration management.

Ruben Cocheno
Spotlight
Spotlight

.

 

Tag me to follow up.
Please mark it as Helpful and/or Solution Accepted if that is the case. Thanks for making Engineering easy again.
Connect with me for more on Linkedin https://www.linkedin.com/in/rubencocheno/