DEV Community


Discussion on: Poll: Do You Know What "Idempotent" Means?

slitcanvas profile image
Adam Smith

My favourite example of a need for an idempotent function was on an old e-commerce site I worked on. Where rather than having a remove line function it used the add to basket function with negative max int. I would have loved an idempotent function rather than having to deal with the side effects caused by a shortcut. Safe, repeatable, no side effects. That's the idempotent dream :)

Forem Open with the Forem app