{"id":89,"date":"2003-02-03T20:52:00","date_gmt":"2003-02-04T00:52:00","guid":{"rendered":"http:\/\/www.markbaker.ca\/wp\/?p=224"},"modified":"2003-02-03T20:52:00","modified_gmt":"2003-02-04T00:52:00","slug":"state-really-is-hell","status":"publish","type":"post","link":"http:\/\/www.markbaker.ca\/blog\/2003\/02\/state-really-is-hell\/","title":{"rendered":"State Really Is Hell"},"content":{"rendered":"<p><a href=\"http:\/\/www.thearchitect.co.uk\/weblog\/archives\/2003\/02\/000049.html\">Jorgen Thelin references<\/a>\n<a href=\"http:\/\/www.dehora.net\/journal\/archives\/000177.html#000177\">Bill de h&amp;#211ra&#8217;s blog on session state<\/a>.<\/p>\n\n<p>Unsurprisingly, it appears there&#8217;s some serious misconceptions about state\ngoing on here.  As <a href=\"http:\/\/www.artima.com\/intv\/distrib4.html\">Ken Arnold said<\/a>,\n&#8220;State is Hell&#8221;, which jives with my experiences.<\/p>\n\n<p>Bill writes;<\/p>\n\n<blockquote>\nOne issue with the REST hypertext model is its view on managing state. REST constrains that state reside on the client, However the real web works precisely backwards to this: all interesting state is kept on the server, as sessions.\n<\/blockquote>\n\n<p>That second sentence is incorrect.  Even cookie based Web apps still keep most application state\non the client.  If they didn&#8217;t, you wouldn&#8217;t be downloading web pages.  The only architectural\nstyle I know of that keeps all state server-side is the Remote Session style, ala\n<a href=\"http:\/\/www.realvnc.com\">VNC<\/a>.<\/p>\n\n<blockquote>\nAnd when exprienced enterprise practitioners like Martin Fowler say that state belongs on the server, it makes you wonder whether REST has anything to offer here.\n<\/blockquote>\n\n<p>I&#8217;d have to see a reference.  I&#8217;d be very surprised if Martin said this in the\nway you&#8217;re implying he meant.<\/p>\n\n<p>Then Jorgen writes;<\/p>\n\n<blockquote>\n[&#8230;] my hunch is that REST can&#8217;t provide a clean solution to the general category of &#8220;conversation&#8221; style applications (involving server-controlled request state transitions) which is the more usual meaning of the concept of &#8220;session state&#8221;.\n<\/blockquote>\n\n<p>I&#8217;m a fuzzy on what Jorgen means by &#8220;server-controlled request state transitions&#8221;, but\nI know that REST can handle what&#8217;s commonly called &#8220;session state&#8221; quite well.  Moreover,\neven HTTP can handle it, without any extensions or use of cookies.  All that&#8217;s needed is\na client side implementation which manages state better.  For example, rather than\nimplementing &#8220;shopping carts&#8221; as a server-side container resource for shopping items,\nimplement it as a generic <em>client-side<\/em> container, where the shopping\/checking\nbehaviour is a result of POSTing a representation of that client-side container to a\ncheckout processor on the server.  This generic client-side container would be useful\nfor holding any application state, and therefore anything you&#8217;d want to do as a session.<\/p>\n\n<p>There&#8217;s all kinds of pros and cons to this of course, as there is with any solution\ndeveloped within the bounds of any architectural style, but REST can do it without\nbatting an eyelash.<\/p>","protected":false},"excerpt":{"rendered":"Jorgen Thelin references Bill de h&amp;#211ra&#8217;s blog on session state. Unsurprisingly, it appears there&#8217;s some serious misconceptions about state going on here. As Ken Arnold said, &#8220;State is Hell&#8221;, which jives with my experiences. Bill writes; One issue with the REST hypertext model is its view on managing state. REST constrains that state reside on [&hellip;]","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-89","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/www.markbaker.ca\/blog\/wp-json\/wp\/v2\/posts\/89","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.markbaker.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.markbaker.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.markbaker.ca\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.markbaker.ca\/blog\/wp-json\/wp\/v2\/comments?post=89"}],"version-history":[{"count":0,"href":"http:\/\/www.markbaker.ca\/blog\/wp-json\/wp\/v2\/posts\/89\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.markbaker.ca\/blog\/wp-json\/wp\/v2\/media?parent=89"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.markbaker.ca\/blog\/wp-json\/wp\/v2\/categories?post=89"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.markbaker.ca\/blog\/wp-json\/wp\/v2\/tags?post=89"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}