Live data from Hacker News

Idempotency

berkansasmaz.com

41–50 of 69 posts

Re: Idempotency

#41

Reading this article is completely safe even if you already understand idempotency.

I want to meet the article that isn’t safe to read even if you’re familiar with its content.

A typical chain letter that implores you to pass it on or you'll suffer dire consequences?

Re: Idempotency

#43
post #6

Idempotency is one mathematical concept that's pretty useful for software engineers to understand. Heck, might be more useful than BigO. - Useful to know when you work with APIs (as the article outlines). - Very useful when working with background jobs. You're not gonna have a good time if those aren't idempotent. - Good to know for interviews. I was asked to explain idempotency a handful of times, weird as that is.

Interestingly, the mathematical definition (and functional programming definition) of idempotency is slightly different. Or I've seen it used slightly differently, anyways - specifically, a function is idempotent if the result of f(x) is the same result as f(f(x)).

I've seen this lead to some confusing back and forth between software engineers, where one engineer means one definition, and the other engineer meant the other definition.

Re: Idempotency

#44

My day-job is Data Engineering. We've carefully built our ETL patterns/tools/data structures to be idempotent. It's amazing how freeing this is. Dealing with cascading failures, intermittent failures, delays, re-runs and time-zones are all os much more manageable when we know that just re-running any given task will do the right thing. It's also amazing how hard of a concept idempotent data pipelines are for some fol…

I try to make my pipelines idempotent, but a couple of them require us to send the output file to someone's email. Does anyone know how to send an email idempotently?

Re: Idempotency

#45

Earlier quoted context omitted.

I’m not totally sure, but in math “idempotent” elements are those for which x^2 = x. And so in software engineering it refers to operations for which doing them twice has the same effect as doing them once. Maybe this is what is meant by “same power”?

It refers to functions where f(x) = x.

That's actually the formula for nullipotency, where applying it 0 times is the same as applying it any number of times.

I believe idempotency is when f(f(x)) = f(x)

Re: Idempotency

#48
I always remember this from the example my professor gave -

   'raise the control rods by 1 inch' 
vs 'raise the control rods to a height of 4 inches'

Re: Idempotency

#49

Earlier quoted context omitted.

I’m not totally sure, but in math “idempotent” elements are those for which x^2 = x. And so in software engineering it refers to operations for which doing them twice has the same effect as doing them once. Maybe this is what is meant by “same power”?

It refers to functions where f(x) = x.

No, it refers to functions f where forall x, f(f(x)) = f(x).

You can abuse notation slightly to see this as f^2(x) = f(x). (This kind of notation is actually used enough to be comfortable to most mathematicians.) From here it's not much of a stretch to eta-contract this to f^2 = f.

And so we've ended up back in the same place...

Re: Idempotency

#50

Fancy word for an obvious concept.

You say it like it's something bad. Having a common vocabulary is extremely helpful for communication. Instead of restating the obvious concept over and over all the time you can just ask your peer "is this idempotent?".

Naming something also helps us to think about it. "A square" is also an obvious concept, but by naming it you can reason about it more easily, and use it to define more abstract concepts later. One of the main reasons we - humans - dominate the earth, is because we evolved an advanced language, which allows us to name ideas and build upon them.

Post reply on HN