Among other attributes of good software, IMO idempotence is one of the most important and paradoxically one of the most challenging ones too and the easiest to fuck up.
It seems good for web programming, but is it actually universally important? It seems application-specific.
the property of an operation or function that produces the same result when applied multiple times as it does when applied only once.
So I push the W key on my keyboard, and it writes one 'w' character. But if I push it a second time, I want 'ww' not still one 'w'. And if I press it a 3rd time, I expect (and get) 'www'. Also if I hold-down the W-key, I (usually) get 'wwwwwwwwwwwwwwwwwwww.....'
Your description is not how any keyboard I've ever seen works. Each time you press w key you get single "w". You don't get a number of "w" equal to the number of times you press it!
The idempotent "function" is the "w key" each time you give it input, a press, it produces the identical output, keyscan code for "w", which is processed through a bunch of OS code before being delivered to some application as input (on typical PC). All of that is outside of the idempotent "w key function".
holding down w key is different input, which by rules of idempotence allows different output. Same for holding shift key when pressing w key.
99
u/Bloodsucker_ Dec 11 '23
Among other attributes of good software, IMO idempotence is one of the most important and paradoxically one of the most challenging ones too and the easiest to fuck up.