The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Score one for ugly URLs

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
Score one for ugly URLs Posted: Feb 10, 2004 2:10 AM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Score one for ugly URLs
Feed Title: Avi Bryant
Feed URL: http://smallthought.com/avi/?feed=rss2
Feed Description: HREF Considered Harmful
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Avi Bryant

Advertisement
Through Patrick Logan, I came across this description of a pattern for avoiding making users "click submit only once" in a web application:
Roughly, it looks like this: 1. The browser requests the Web page that contains the final order form (with the 'Submit' button in it), 2. The server sends back a page whose form has a unique 'action' link; e.g., "http://shop.example.com/orders/1234", 3. The user submits the form, which is POSTed to the 'action' link, in turn submitting the order. 4. The server sends back a page that says that the order has been successfully submitted.
Yup. That sounds an awful lot like Seaside, where every link and form action has exactly that kind of unique URL. In Seaside, this particular pattern would be expressed by putting the final order form (in fact, probably the entire order process) inside an isolate: block, with the confirmation outside of it. As soon as you exit the isolate block, any urls generated inside of it become invalid, so you can't submit to them a second time. But until then you can backtrack and resubmit all you like. The code could look like this:

goShopping



self isolate: [

   self fillTheShoppingCart.

   self getTheOrderInfo.

   self askUserIfTheyDefinitelyWantToOrder

].

self tellTheUserTheOrderIsSubmitted.

People often complain about having "meaningless" numbers in the URLs, but they enable a level of abstraction over HTTP that wouldn't otherwise be possible. Getting rid of "click submit only once" is just one of the things that makes easy.

Read: Score one for ugly URLs

Topic: On ordering testcases Previous Topic   http://www.paulgraham.com/avg.html | sed s/Lisp/Smalltalk/g">Next Topic http://www.paulgraham.com/avg.html | sed s/Lisp/Smalltalk/g">Topic: curl <a href=http://www.paulgraham.com/avg.html | sed s/Lisp/Smalltalk/g" border="0">

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use