More control with idempotency
Idempotency has become one of my favorite principles for designing systems. When programs are designed to be idempotent, I feel much more in control and know better what is going on. So let’s take a closer look into the idempotency by trying to design a simplified real-life idempotent program.
Our use-case here will be about the health monitoring of charge-points for electric vehicles. Let’s assume that our system is already able to detect alerts on such charge-points, and our task is to send emails to the charge-point owners notifying them about the detected alerts. (To make things simpler for now, let’s assume that there can be only one alert on a given charge-point during its whole lifetime. Later, we will also discuss how to approach multiple alerts). Now, let’s try to design such a program in an idempotent way.
Our visual grammar for this example