• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

about idempotent?

 
david carrasco
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

what about idempotent?
can someone explain me please...

thanks a lot
 
Paul Croarkin
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Idempotent means that you can make the same request multiple times without causing a side effect. Normally doing a GET would be idempotent whereas a PUT would be non-idempotent.
 
Paul Croarkin
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, see:
http://dictionary.reference.com/search?q=idempotent
 
Guy Allard
Ranch Hand
Posts: 776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure why this question would go in this forum .......

I think of idempotent in terms of C/C++ header files written like this:



Guy
[ November 15, 2004: Message edited by: Guy Allard ]
 
Paul Croarkin
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure why this question would go in this forum .......


The javadoc for HttpServlet uses the term "idempotent":

The GET method should also be idempotent, meaning that it can be safely repeated. Sometimes making a method safe also makes it idempotent. For example, repeating queries is both safe and idempotent, but buying a product online or modifying data is neither safe nor idempotent.

[ November 15, 2004: Message edited by: Paul Croarkin ]
 
Guy Allard
Ranch Hand
Posts: 776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah yes.

A much older term is "serially reusable".

Guy
[ November 15, 2004: Message edited by: Guy Allard ]
 
Balu podapati
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Idempotent means perfoming an operation with no side affects. other than POST all other header methods(GET, PUT, TRACE OPTIONS)are considered to be idempotent(potentially causing no harm) . So you think why POST is not idempotent(causing harm), bcoz it not only retrieved the web page the user wants but also writes the same to database. A simple example you can consider here is this:

You have a webapplication and suppose in that you wanted to bill your items which you checked in. You click submit payment once...and it calls the doPost method of the servlet which inturn writes it to Database.
In the mean time you thought that its not working and refreshed the page and clicked submit payment again. this causes your account to be billed again for the same items. Isnt that disasterous such type of applications should be handled properly in a doPOST. Since POST has such potential to cause problems..it is said to be a Idempotent.

HFS book describes clearly with pictures. The above example I referred from HFS.

Thanks
Balu(SCWCD Appearing)
 
Jack Lam
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
---------------------------------------------------------------
quote:
You have a webapplication and suppose in that you wanted to bill your items which you checked in. You click submit payment once...and it calls the doPost method of the servlet which inturn writes it to Database.
In the mean time you thought that its not working and refreshed the page and clicked submit payment again. this causes your account to be billed again for the same items. Isnt that disasterous such type of applications should be handled properly in a doPOST. Since POST has such potential to cause problems..it is said to be a Idempotent.
---------------------------------------------------------------

maybe i am wrong..... the main different between Post and Get method is ... the data store in message body in Post method and the data store in URL in Get method...so i think there is no differnt when user reload the page in browser and submit the form again...
the process page also will process the data twice even we use Get method.

Thanks and Regards

Jack
 
Paul Croarkin
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
maybe i am wrong..... the main different between Post and Get method is ... the data store in message body in Post method and the data store in URL in Get method...so i think there is no differnt when user reload the page in browser and submit the form again...
the process page also will process the data twice even we use Get method.


It is possible to submit a form via GET that would cause a change on the server that would be non-idempotent such as ordering an item from an on-line store.

It is also possible to submit a form via POST that would in essence be idempotent (that is not causing an event that should not be repeated). An example of this would be to post a form of search criteria that brings back the results of the search.

I think that for the exam the important thing to keep in mind is that, in general, the specs consider GET to be idempotent and POST to be non-idempotent. I also believe that it is important to understand an example scenario and be able to tell whether it is idempotent or not.
[ November 16, 2004: Message edited by: Paul Croarkin ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic