This got me to think: are continuations equivalent of sessions?
The original intent (indicated in Shriram's research paper) of web-server's continuation is to correctly and succinctly model interactive web application's application flow. The paper sites examples of incorrectly implemented web apps that would do something like the following:
- user browse a list of goods
- user opens new window to get the details of goods A
- user goes back to original window
- user then opens another new window to get the details of goods B
- user then goes to goods A and click "Buy Now"
- incorrectly implemented app will cause the user to buy goods B instead of goods A
But for other scenarios involving sessions it might be more natural to model the computations by using the traditional session concepts.
For example - identifying the user across visits after significant time lapse (this is generally toggled by a "remember me" checkbox during login). Normally web sites accomplish this by persisting the user's authenticators via cookies or sessions.
This process is awkward to model with continuations, since the user likely come back to the site via a top level link that has no captured continuations, instead of digging up the last continuation url for the site, and the continuations might have expired between the visits if you use stateful servlets.
If you use web-server's stateless servlet language, an approach is probably to serialize the continuation into a cookie so it can model the above scenario, but you'll have to write your code in the stateless language or convert your code over, and it feels like a more complex solution compared to simply having a regular session capability. This is similar to using continuations to model non-interactive web links - it can work, but it does not follow Occam's razor.
Furthermore - if your site uses extensive ajax, your use of continuations will decrease, since Ajax models the interactions as well and supplants the needs for continuations. and in such case you might regain the needs for sessions that was reduced by continuations.
So, as far as I can tell, continuations is not equivalent to web sessions and do not eliminate the needs for session capabilities.
No comments:
Post a Comment