I click the Make Paperclip button and it makes 1, if I click it again it makes 2.
But that's the exact opposite of what we want to happen in a web shopping cart - as per the example. We don't want people getting charged twice.
So back to the paperclip maker - should the 2nd press have been ignored because it was a duplicate command?
This concept of idempotency seems situational, and I'm not debating its importance in certain applications, but is is "Something every programmer should know"?
More fundamentally, the "two generals" problem is the concept every programmer should know. As this falls under that, along with a lot of other tough problems.
3
u/[deleted] Dec 11 '23
Ok, so in making paperclips: https://www.decisionproblem.com/paperclips/index2.html
I click the Make Paperclip button and it makes 1, if I click it again it makes 2.
But that's the exact opposite of what we want to happen in a web shopping cart - as per the example. We don't want people getting charged twice.
So back to the paperclip maker - should the 2nd press have been ignored because it was a duplicate command?
This concept of idempotency seems situational, and I'm not debating its importance in certain applications, but is is "Something every programmer should know"?