论坛首页 Ruby版 ruby

REST和Continuation是否是矛盾的?

浏览 1084 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
最后更新时间:2007-05-23 关键字: REST
不知道这个话题发哪里,搜索了一下只有Ruby和Java版有探讨Continuation的,相比之下Java的实现只能算hack,所以还是发到这里了。只是想抛砖引玉一下,REST本质上要求服务端是无状态的,而Continuation却正好相反。那么对于一个基于REST的应用来说,是否就不该引入Continuation?
   
最后更新时间:2007-05-23
一般人開始使用 Web 的時候
會拿一般 Programming 的觀念去 coding Web Application
但是 Web 其實跟我們熟悉的環境不同
stateless 的特性讓一般人非常不習慣
所以才有 continuation 的出現
但是這樣的作法其實是用  coding Web Application not by the Web Way
其實是一種強迫天空中飛的鳥在地上爬的感覺
(用鳥在地上爬的比喻方式,不是想說那種方式比較好,而是告訴大家,什麼樣的架構就用什麼樣的概念來 coding)

而且其實 Web 的 Stateless 特性其實帶來了相當多的好處
REST 的出現是告訴大家重視 Web 的特性
並且 coding Web Application by the native Web way

所以原則上來說兩者是互斥的
   
0 请登录后投票
最后更新时间:2007-05-23
搜到seaside的作者avi bryant的一篇blog
http://smallthought.com/avi/?p=14
讲述这个问题
将应用分成三种情况:
引用

Ultimately, I think all three models - state via REST, state via continuations or closures, state via Ajax - are important, and the job of a good web developer is to choose, for each user interaction, when to use which one. In terms of my personal heuristics, they break down like this:
1 Need quick response, but don’t need back button or bookmarking: AJAX
2 Need back button, don’t need bookmarking: use continuations/callbacks
3 Need bookmarking or other external access: use REST

类似的还有一篇文章:
http://ll4.csail.mit.edu/slides/rest-slides.pdf
   
0 请登录后投票
论坛首页 Ruby版 ruby

跳转论坛:
JavaEye推荐