News for hackers. Stuff that matters.
Re:Some web development tips from a former Digg developer by paulgb on Friday August 24, 2012 @03:47PM (#4429290)
> Therefore the results are different for different states and it is not idempotent.

No, from all states, the result is that you're logged out.

Re:Some web development tips from a former Digg developer by firat on Friday August 24, 2012 @05:08PM (#4429672)
I don't think this is the right way to think about it. The ending "state" might be the same, but the output of the first logout operation would be "change of state: logged in -> logged out". In the second case, however, it would be "no change in state". It does different things under different circumstances.
Re:Some web development tips from a former Digg developer by kilburn on Friday August 24, 2012 @05:20PM (#4429747)
From the Wikipedia article on Idempotence [1]:

  Similarly, changing a customer's address is typically
  idempotent, because the final address will be the same 
  no matter how many times it is submitted.
So, even if in one case there's an internal state change (going from an old address to a new one) whereas in the other there is not (going from the new address to the new one again), it is commonly considered idempotent because the end result is the same.

[1] http://en.wikipedia.org/wiki/Idempotence#Computer_science_me...

Re:Some web development tips from a former Digg developer by firat on Friday August 24, 2012 @05:52PM (#4429878)
Okay, I understand that the formal definition of "idempotent" is different than what the author means. What is the correct term to use in this case?

Edit: Next paragraph says:

  This is a very useful property in many situations, as it means that an operation can
  be repeated or retried as often as necessary without causing unintended effects.
  With non-idempotent operations, the algorithm may have to keep track of whether the
  operation was already performed or not.
"A change in state" would be an unintended effect I think.
Re:Some web development tips from a former Digg developer by saurik on Saturday August 25, 2012 @03:12AM (#4431338)
I think the best "term" you can use here is "side effect free". I almost wanted to say "pure" would work, but there is no real requirement that GET always return the same thing: it just needs to not change the state of the server in a way that a later GET could detect (although, honestly, you really only practically care about "find bothersome", and if there is a term for "bothersome side effect free" it would probably be from medicine and not computer science).
Re:Some web development tips from a former Digg developer by wtetzner on Friday August 24, 2012 @05:32PM (#4429795)
"Idempotence is the property of certain operations in mathematics and computer science, that they can be applied multiple times without changing the result beyond the initial application."[1]

[1] https://en.wikipedia.org/wiki/Idempotence

Re:Some web development tips from a former Digg developer by firat on Friday August 24, 2012 @05:48PM (#4429861)
What is the definition of "result". My point is that result in this case is a "change of state" vs "no change in state".
Re:Some web development tips from a former Digg developer by rhizome on Saturday August 25, 2012 @02:30PM (#4432770)
the result of multiple log out attempts will be "attemptor will be logged out."
Re:Some web development tips from a former Digg developer by ajanuary on Saturday August 25, 2012 @08:21AM (#4431861)
"Methods can also have the property of "idempotence" in that ... the side-effects of N > 0 identical requests is the same as for a single request." [1]

The HTTP spec clearly talks in terms of the effect of sequences of repeated operations, not in terms of the results of individual operations. The side effects of a single logout are the same as for 6 - you are logged out and whatever logout triggers exist are executed once.

[1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.1...