<rss version="2.0"
xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">
 <channel>
  <title>News You Can Bruise</title>
  <link>http://www.crummy.com/</link>
  <description>Your chicken, your egg, your problem</description>
<creativeCommons:license>http://creativecommons.org/licenses/by-sa/2.0/</creativeCommons:license>
  <image>
   <url>http://www.crummy.com/nb/resources/img/export.png</url>
   <title>News You Can Bruise</title>
   <link>http://www.crummy.com/</link>
  </image>
  <managingEditor>leonardr@segfault.org (Leonard Richardson)</managingEditor>
  <language>en-us</language>
  <docs>http://backend.userland.com/rss</docs>
  <lastBuildDate>Wed, 27 Aug 2008 02:56:46 GMT</lastBuildDate>
<item>
 <description>Apropos &lt;a href="http://www.qwantz.com/archive/001291.html"&gt;today's Dinosaur Comics cartoon about abrupt sex changes&lt;/a&gt; I emailed Ryan to tell him about a movie I'd seen in India. There were no subtitles but I got the gist of it:

&lt;blockquote&gt;
[A] guy was a
jerk to women, and ended up getting hit on the head with a statue of
Shiva [on second thought, maybe it was just a random statue -LR]. He had a dream where Shiva and Parvati lectured him, and when
he woke up he'd been turned into a woman. It was wacky! But then he
slept with his best friend or something, and got pregnant! And then
the girl he was a jerk to framed him for the murder of his male self!
He went to jail! He was about to give birth when we got to the airport
and I stopped watching the movie.

&lt;p&gt;Unfortunately it's difficult for me to search for this movie because
some subset of these things happens in almost every Bollywood movie.
This was just the one that had it all.
&lt;/blockquote&gt;

&lt;p&gt;Ryan's friend Priya knew the movie! It's called &lt;A href="http://www.imdb.com/title/tt0456549/"&gt;Mr Ya Miss&lt;/a&gt;, and Priya comments: "It is the worst movie ever." Also, apparently the blow to the head actually killed the protagonist, and the scene with Shiva and Parvati was a reincarnation interview. I don't think reincarnation is supposed to give you a fully mature new body, but Parvati works in mysterious ways her wonders to perform. And how can you say a movie is the worst ever when the main character gets killed fifteen minutes into the movie? &lt;a href="http://www.crummy.com/2005/04/09/1"&gt;I've been waiting for that for years!&lt;/a&gt;</description>
 <pubDate>Wed, 27 Aug 2008 02:56:46 GMT</pubDate>
 <category domain="http://www.crummy.com/nb/nb.cgi/category/nycb/">film</category>
 <guid isPermaLink="true">http://www.crummy.com/2008/08/26/2</guid>
</item>
<item>
 <title>Content-Encoding versus Transfer-Encoding</title>
 <description>Today I discovered a "problem" where Apache's mod_deflate changes a resource's ETag value from &lt;code&gt;"foo"&lt;/code&gt; to &lt;code&gt;"foo"-gzip&lt;/code&gt; when compressing the representation. &lt;a href="http://www.intertwingly.net/blog/2007/09/30/Etag-vs-Encoding"&gt;This problem has been a while in coming&lt;/a&gt;, and after some research I'm convinced that Apache's behavior is almost completely correct.[0] But very annoying. Your representations are transparently compressed on the way out, but then the client sends you values for If-Match and If-None-Match that you've never seen before. True transparency is a two-way street.

&lt;p&gt;There are a number of ways to solve the problem. One way would be for Apache to magically strip the "-gzip" off the entity-tags when they come back in, but how is Apache supposed to know that that particular -gzip was one it added? So, as usual, the magic solution fails.

&lt;p&gt;An alternative that appeals to me is to stop treating compression as an aspect of the representation such that having it or not having it means you need to change the ETag. Move it out of Accept-Encoding and Content-Encoding, and into TE and Transfer-Encoding. This is related to what I was saying &lt;a href="http://www.crummy.com/2007/05/31/1"&gt;last year&lt;/a&gt;, but I didn't make the connection between "this is part of the transmission, not part of the representation" and "this should be in Transfer-Encoding, not Content-Encoding." Or to quote &lt;a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.41"&gt;the RFC&lt;/a&gt;, "the transfer-coding is a property of the message, not of the entity."

&lt;p&gt;The problem with this is that Transfer-Encoding describes the transmission from one intermediary in a chain to the next, not the transmission from server to client. Similarly for TE and the transmission from client to server. Intermediaries are my RESTful weak point so I don't fully grasp the implications of this. If the client sends &lt;code&gt;TE: gzip&lt;/code&gt;, the proxy can decide to get an uncompressed representation, look at it, and then compress it before sending it back to me. That hurts performance but everything still works, right?

&lt;p&gt;&lt;b&gt;Update:&lt;/b&gt; &lt;a href="http://mail-archives.apache.org/mod_mbox/httpd-dev/200612.mbox/%3CB2A9B2B3-D938-4C7D-8434-B9FC00A120D3@gbiv.com%3E"&gt;"That is why transfer encoding was invented in the first place."&lt;/a&gt;


&lt;p&gt;[0] To be 100% correct it would change the ETag to &lt;code&gt;"foo-gzip"&lt;/code&gt;, since entity-tags are supposed to be enclosed in quotes.</description>
 <pubDate>Tue, 26 Aug 2008 22:23:19 GMT</pubDate>
 <category domain="http://www.crummy.com/nb/nb.cgi/category/nycb/">rest</category>
 <guid isPermaLink="true">http://www.crummy.com/2008/08/26/1</guid>
</item>
<item>
 <description>If you're up on your &lt;i&gt;Anathem&lt;/i&gt; gossip you'll know that the book (or, at least, the Advance Reader's Copy) comes with a CD of nice acapella chant music. What has been somewhat obscured by descriptions of this music is that each piece doesn't just have a fancy math-related title, it actually is a piece of math. Usually a description of a cellular automaton, or a proof represented in some bizarre musical G&amp;ouml;del-encoding. And what I didn't know until Mirabai emailed me is that the scores for these songs are being &lt;A href="http://synthesist.net/tunes/scores/iolet.xml"&gt;published&lt;/a&gt; by their author, David Stutz.</description>
 <pubDate>Tue, 26 Aug 2008 21:27:25 GMT</pubDate>
 <category domain="http://www.crummy.com/nb/nb.cgi/category/nycb/">math%20music</category>
 <guid isPermaLink="true">http://www.crummy.com/2008/08/26/0</guid>
</item>
<item>
 <title>Totally Heavenly Product</title>
 <description>More praise from spam weblogs:

&lt;blockquote&gt;
I must assert that I’m generally one that does not love shopping online, but my concept on that has changed since I ordered my RESTful Web Services from ebay...

&lt;p&gt;My RESTful Web Services arrived in a week from my seller. The RESTful Web Services was exactly as it was described! I am so at ease about ebay, I’m sure I will go back for more!

&lt;p&gt;I have left more info on RESTful Web Services, a &lt;a href="http://www.crummy.com/pix/2002/0704-fun/15-crank-cleanser.jpg"&gt;totally heavenly product&lt;/a&gt;...
&lt;/blockquote&gt;

&lt;p&gt;&lt;tt&gt;I see nothing special about the RESTful Web Services.&lt;br /&gt;
&amp;gt;&lt;/tt&gt;</description>
 <pubDate>Tue, 26 Aug 2008 00:53:28 GMT</pubDate>
 <guid isPermaLink="true">http://www.crummy.com/2008/08/25/2</guid>
</item>
<item>
 <title>Crankiness Antidote</title>
 <description>So the only thing I post today isn't me bring cranky, check out &lt;a href="http://tor.com/index.php?option=com_content&amp;view=blog&amp;id=3949"&gt;this excellent summary&lt;/a&gt; of the  &lt;a href="http://www.launchpadworkshop.org/"&gt;Launch Pad Astronomy Workshop&lt;/a&gt;, where writers go to learn about the universe. Yes, &lt;a href="http://www.nasaimages.org/"&gt;this universe&lt;/a&gt;.</description>
 <pubDate>Tue, 26 Aug 2008 00:44:34 GMT</pubDate>
 <guid isPermaLink="true">http://www.crummy.com/2008/08/25/1</guid>
</item>
<item>
 <description>&lt;a href="http://futurismic.com/2008/08/23/is-short-fiction-devalued-by-being-available-for-free/"&gt;Is short fiction devalued by being available for free?&lt;/a&gt; Hey, here's the elephant in the room that keeps being pointed out and yet remains elephant-shaped: there's way more short fiction than there is market for it. In my writing group we critique 2-3 stories a month. Half of 'em are a rewrite away from publication quality. They're also likely years away from publication, because the market is so small and response times so long. 

&lt;p&gt;Why do the markets pay so poorly? That's the natural result of massive oversupply. Why is there so much bad free stuff online? My portfolio shows the problem in miniature. My old crappy stories are online because I didn't know any better. My dynamite new stuff circulates endlessly through snail and electronic mail. Sure, I'm bitter, but it seems pointless to complain about this because the solution is obvious.

&lt;p&gt;Seriously, what am I doing? I don't care about money--there's not enough to care about. If I wanted an audience I'd split my stories into RSS-feed cliffhangers and put them in syndication once they passed writing group muster. All that's left is the feeling that there are dues I ought to be paying. I've got a &lt;a title="Specifically, I'm linking to the VP Oath here." href="http://www.aestheticism.com/Visitors/Editor/nora/pastime_paradise/index.htm"&gt;bad case of professionalism&lt;/a&gt;.

&lt;p&gt;Who needs it? Life is too short. I know what position I'm sliding towards and I keep resisting it. Maybe I'll start writing novels instead; those take a lot longer to crank out, at least.</description>
 <pubDate>Tue, 26 Aug 2008 00:04:04 GMT</pubDate>
 <category domain="http://www.crummy.com/nb/nb.cgi/category/nycb/">writing</category>
 <guid isPermaLink="true">http://www.crummy.com/2008/08/25/0</guid>
</item>
<item>
 <description>Best "I &amp;hearts; NY" shirt ever: one in which the shirt is the same color as the &amp;hearts;, making it read "I&amp;nbsp;&amp;nbsp;&amp;nbsp;NY".</description>
 <pubDate>Sun, 24 Aug 2008 22:46:02 GMT</pubDate>
 <guid isPermaLink="true">http://www.crummy.com/2008/08/24/0</guid>
</item>
<item>
 <description>I was reading &lt;a href="http://laweekly.blogs.com/joshuah_bearman/2008/08/finally-the-kil.html"&gt;an interesting article&lt;/a&gt; about competitive video game players. Some of these players express a strange attitude towards a game's "kill screen", the point at which the game breaks down because the authors didn't anticipate anyone getting that far.

&lt;p&gt;From a programmer's perspective the kill screen is something to be decoded and understood. &lt;a href="http://donhodges.com/how_high_can_you_get2.htm"&gt;It is comprehensible and can be fixed.&lt;/a&gt; But when the kill screen comes at the end of a grueling ritual there seems a temptation to see it in esoteric and mystical terms.

&lt;blockquote&gt;
With Pac-Man, there has always been a powerful appeal surrounding the notion of "The Doorway" -- a prospective passageway to the other side, a way past level 256... the final prize Pac-Man collects is not a fruit but a key, the last of nine--and why are there keys if there is nothing to unlock?
&lt;/blockquote&gt;

&lt;p&gt;Before I go on, let me make my position clear: I am a total video game nerd (though not a particularly &lt;a href="http://www.screwattack.com/AVGN/"&gt;angry&lt;/a&gt; one). Songs have I written and stories that draw from this pixelated well. My cohort has a fascination with video games: old ones, new ones, the people who make them, the ones we make ourselves, their distribution mechanisms, their similarities and basic building blocks, the ways we push ourselves to best them, the stories we tell about them, the relationships they create and mediate.

&lt;p&gt;So don't take it as "Get a life!" when I say there's nothing special about the games themselves. Like books, they only have the power we give them. Pac-Man has a bug. It's not even an Easter Egg. There's nothing to unlock. The kill screen is not in the realm of the meant. If you spend years mastering Pac-Man and prefer it to Ms. Pac-Man because it's totally deterministic, why get mystical about the way it crashes at the end? This is real life, not &lt;i&gt;Lucky Wander Boy&lt;/i&gt;.

&lt;p&gt;I could see writing fan fiction about bugs, the same kind of fan fiction that explains what it means to make the Kessel Run in twelve parsecs, but this kind of talk about the bug's mysterious meaning leaves me cold.

&lt;p&gt;PS: Feel free to apply this attitude to &lt;a href="http://www.crummy.com/2006/08/26/0"&gt;everything else in life!&lt;/a&gt; Other people will love it!

&lt;p&gt;PPS: The keys are for use in Super Pac-Man.</description>
 <pubDate>Sat, 23 Aug 2008 21:02:13 GMT</pubDate>
 <category domain="http://www.crummy.com/nb/nb.cgi/category/nycb/">games</category>
 <guid isPermaLink="true">http://www.crummy.com/2008/08/23/0</guid>
</item>
<item>
 <title>Das Komputermaschine Ist Nicht</title>
 <description>I saw a German ad for the Commodore 64 and it got me thinking about how many C64s made it into &lt;i&gt;East&lt;/i&gt; Germany. The &lt;a href="http://www.bbc.co.uk/wiltshire/features/polyplay.shtml"&gt;PolyPlay&lt;/a&gt; was made in the mid-80s, and it was extremely popular despite the games being terrible by 1985 standards, especially compared to the C64. (You can play the PolyPlay games on MAME, or in Flash &lt;a href="http://www.polyplay.de/?m1=play"&gt;here&lt;/a&gt;.)

&lt;p&gt;Well, in a move that can only be described as "astounding" I did some searching and found &lt;a href="http://www.victoria.ac.nz/seftms/media-studies/staff/Publications/Articles/planspielost.aspx"&gt;this translated essay on the topic&lt;/a&gt;. It's excellent. It takes you through the adolescence of an East German computer nerd, with its PolyPlays and its Robotron computers and its sections in the back of state-sponsored ham radio magazines. Once nerds got their own computers they were able to clone the PolyPlay games and distribute the clones through the mail.

&lt;p&gt;Another interesting aspect is the difference between West Germany, which took a &lt;i&gt;Music Man&lt;/i&gt; anti-pool-table approach to video games, and the East, which coopted the mania (or, I suppose, c&amp;ouml;opted it).

&lt;blockquote&gt;
Computer gaming was made a matter of the State – and computer gaming was officially labelled "Computersport", which means "computer sports" [thank you. -LR]. Connecting computer gaming to politics had a huge impact on the future development of computing in East Germany... In West Germany, in 1984 a new youth protection law prohibited gaming computers at public places. The new technologies were denounced to have a bad influence on young people, who from then had to go to bars if they wanted to play. In East Germany, the government had realised that computers were to become an important economic means in the future... Inspired by the Polyplay, or by visits at relative's places, many youths started putting together their own computers, or to program their own games.
&lt;/blockquote&gt;

&lt;p&gt;And at the end, the essay answers my question. 

&lt;blockquote&gt;
Even before the borders were opened, and in spite of an import prohibition, advertisings in the Funkamateur [the aforementioned ham radio magazine -LR] offered C64 computers for 5000 East Mark, a horrendous price. But nevertheless, the commodore took over in the Berlin scene.
&lt;/blockquote&gt;

&lt;p&gt;After that, unfortunately, "programming was less important here than cracking and copying C64 games." Thanks for the essay, Thilo Mischke and Kerstin Grosch. And Melanie Swalwell, for hosting the essay and also &lt;a href="http://www.vectorsjournal.org/issues/03_issue/goldenage/recollection.php"&gt;creating some sort of interactive oral history of video games in New Zealand&lt;/a&gt;.

&lt;p&gt;One thing that didn't occur to me until I started writing this entry was that the people who made PolyPlay must have played a bunch of decadent Western games to figure out which ones to clone.</description>
 <pubDate>Thu, 21 Aug 2008 13:04:55 GMT</pubDate>
 <category domain="http://www.crummy.com/nb/nb.cgi/category/nycb/">games</category>
 <guid isPermaLink="true">http://www.crummy.com/2008/08/21/0</guid>
</item>
<item>
 <title>"A large bubble rises to the surface and pops"</title>
 <description>The bathroom sink was draining slowly. I didn't want to buy a plunger or a specialized drain-cleaning chemical so I tried some &lt;a href="http://www.treehugger.com/files/2008/08/stuff-happens-bill-nye-series-premiere.php"&gt;Bill Nye&lt;/a&gt; the Science Guy-level science and made a fourth grade science fair in the sink. I poured some baking soda into the sink and washed it down with a minimum of water. Then I poured in some vinegar. It bubbled. Eventually I shut the drain in hopes that the CO&lt;sub&gt;2&lt;/sub&gt; would build up pressure in the pipes and eject whatever was clogging the drain, but it didn't seem to be necessary. The sink works fine now.

&lt;p&gt;Unlike more common uses of the deadly vinegar/baking soda combo, this would actually be a good fourth-grade science fair project.</description>
 <pubDate>Wed, 20 Aug 2008 21:12:43 GMT</pubDate>
 <guid isPermaLink="true">http://www.crummy.com/2008/08/20/0</guid>
</item>
<item>
 <description>While I wait for the dubbed edition of GameCenter CX to come out on DVD, I've been watching &lt;a href="http://www.youtube.com/user/Frankomatic"&gt;Frankomatic's "Obscure Game Theater"&lt;/a&gt;, a mile-long series of YouTube videos in which the aforementioned Frankomatic gives  retro games his ganbatte best, except with more cursing than you get from Shinya Arino.

&lt;p&gt;While watching one of these videos I realized that A Boy and His Blob, possibly the NES game to combine the coolest concept with the worst execution, takes place in New Jersey. You start off looking at what seems to be the Empire State Building across a body of water,  and as you run to the right (ie. south) you see the Manhattan skyline with the World Trade Center at the far right. It's a very nice graphic, actually, probably digitized from a photo (Wikipedia and &lt;a href="http://www.secinfo.com/$/SEC/Registrant.asp?CIK=0000898739"&gt;the SEC&lt;/a&gt; agree that Absolute Entertainment was based in New Jersey). I think the game is supposed to take place in Brooklyn instead of Hoboken, because it's got a subway station, but basic directionality says the game board is to the west of Manhattan.</description>
 <pubDate>Wed, 20 Aug 2008 03:23:59 GMT</pubDate>
 <category domain="http://www.crummy.com/nb/nb.cgi/category/nycb/">games</category>
 <guid isPermaLink="true">http://www.crummy.com/2008/08/19/3</guid>
</item>
<item>
 <description>That one deserved its own entry. Onwards! &lt;a href="http://www.tbray.org/ongoing/When/200x/2008/08/18/On-REST"&gt;(Again, here's the document I'm responding to.)&lt;/a&gt;

&lt;p&gt;&lt;i&gt;Is Statelessness Required?&lt;/i&gt; The universe will not end in an ontological segfault if you violate statelessness. Instead, you will give up a lot of scalability potential, and you will hide state where your clients can't get at it, which will annoy them. So why do it? Maybe because you're using a framework that makes it really easy to write programs that violate statelessness, and then tries complicated tricks to get scalability back, because that's the way web frameworks have been written for ten years.

&lt;p&gt;We took a pretty hard anti-cookie line in &lt;i&gt;RWS&lt;/i&gt; (pages 252-253), but we made it clear that cookies themselves are not the problem. Cookies, like links, are a way of serving application state. They have one big RESTfulness problem but it's moot because nobody follows the cookie standard that slavishly. The real problem is the session IDs that go into those cookies.

&lt;p&gt;A session ID is a key into a big chunk of state kept invisibly on the server. That's what causes the problems. It's just as wrong to serve that session ID as a query variable in a link as it is to serve it in a cookie. You need to turn the hidden state into application state by incorporating it into links and forms, or you need to turn it into resource state by exposing it as part of your web service and letting clients manipulate it directly.

&lt;p&gt;&lt;i&gt;Is Being Message-Centric Good Enough?&lt;/i&gt; I say yes. I'm young enough that the Web is the first distributed programming environment I ever used. I've never felt like I was missing something that justified switching to a competitor. The more I've learned about its design the more impressed I've been. When something better comes along, I predict it will look more like the Web than it will look like DCOM or CORBA or WS-*, whether it's "better" in a global sense or in some application-limited sense.

&lt;p&gt;&lt;i&gt;Are PUT and DELETE Essential?&lt;/i&gt; The universe will not end in an ontological segfault etc. Also, you won't even stop being RESTful, assuming you have proper resource design, as per my first entry in this series. What you'll give up is the ability to make various reliability guarantees. I was going to say you also give up the ability to avoid the lost-update problem, but I guess you could do that with POST, so long as (yes) you were POSTing to the same URI you sent GET to earlier.

&lt;p&gt;I don't know how good an argument this is anymore, but: designing with PUT and DELETE forces you to think in terms of resources. It's a form of discipline, like eschewing cookies. When you've got "read data" and "whatever!" it's very easy to think in terms of operations, flex your ten-year-old web application muscles, and end up with a mess like the Flickr web service. The vocabulary is negotiable. The underlying idea, (that a URI designates an object which responds to a standard vocabulary) is essential. That's the Architecture of the World Wide Web.

&lt;p&gt;&lt;i&gt;Is "Do Like the Web" a Good Argument?&lt;/i&gt; Not in and of itself, because parts of the Web are lousy. You need a tool to separate the good from the bad. I follow the admonition of Paul: "Prove all things; hold fast that which is good." Look at what people love about the Web and see if you can bring that same joy to distributed programming. Look at what people complain about and try to eliminate those things, whether you're building web applications or web services. When you find something that improves the distributed programming side of things, bring that knowledge back into the field of web application design.

&lt;p&gt;&lt;i&gt;Where Are The Tools?&lt;/i&gt; Traditionally this question has been answered by assertions that the (HTTP-level) tools already exist. As annoying as this answer is, it's technically correct. Without additional abstractions on top of HTTP/URI/*ML, there's nothing to write tools about. As we invent those abstractions (AtomPub, ROA, the ActiveResource control flow, OAuth, WADL, etc.) we write more tools. I'm writing tools now. As we get more practice the higher-level tools will get better, and as they get better they'll consolidate (as will the abstractions beneath them) and there will be fewer.

&lt;p&gt;One thing I'd like to add is that it would be cool to see the existing frameworks &lt;i&gt;for web applications&lt;/i&gt; apply some of the principles people have come up with while using the Web as a distributed programming environment. Make it easy to publish resources rather than operations, easy to support conditional GET, easy to write client interactions that respect statelessness. Rails has the right idea here.</description>
 <pubDate>Tue, 19 Aug 2008 19:28:44 GMT</pubDate>
 <category domain="http://www.crummy.com/nb/nb.cgi/category/nycb/">rest</category>
 <guid isPermaLink="true">http://www.crummy.com/2008/08/19/2</guid>
</item>
<item>
 <title>'What Does "Hypermedia as the Engine of Application State" Mean, Really?'</title>
 <description>It means that you operate the web service by following links and filling out forms. (For definitions of "link" and "form" that depend on the media type.) It means you can use a generic "web service browser" that doesn't have a bunch of hard-coded knowledge about one particular web service, the way &lt;a href="http://www.josephson.org/projects/pyamazon/"&gt;PyAmazon&lt;/a&gt; does. When the web service changes, user behavior may need to change with it, but the client itself isn't instantly rendered useless, the way &lt;a href="http://www.crummy.com/2008/03/23/0"&gt;PyAmazon was&lt;/a&gt;.
I called this "connectedness" in &lt;i&gt;RWS&lt;/i&gt;, and &lt;a href="http://roy.gbiv.com/untangled/2008/on-software-architecture"&gt;Roy Fielding himself slammed me for it&lt;/a&gt;, but when 
Tim Bray, after years of real-world experience, isn't sure what "hypermedia as the engine of application state" means, I think that's a sign it needs to be explained in different words.

&lt;p&gt;Saying that RESTful services "work like the web" is not just saying that things have URIs or you can cache GET requests. Ideas as confusing as hypermedia-as-the-engine-of-application-state become
understandable when you think about the way you use the web.

&lt;p&gt;If a website is well-designed, you don't need to mess around with the URL bar to get where you want to be: you fill out forms and follow links. You don't need a custom web browser to use crummy.com. My website is distinguished from all other websites by the HTML documents I serve. If I change my weblog software, it'll serve you different documents, and you may have to change the way you use the website, but your browser doesn't crash.

&lt;p&gt;You know what to do (how to drive the crummy.com "application" into the desired state) because the document I send you lays out your options. And because the document represents the options as hypermedia links and forms, you know how to build an HTTP request that will carry out your desires.</description>
 <pubDate>Tue, 19 Aug 2008 19:04:38 GMT</pubDate>
 <category domain="http://www.crummy.com/nb/nb.cgi/category/nycb/">rest</category>
 <guid isPermaLink="true">http://www.crummy.com/2008/08/19/1</guid>
</item>
<item>
 <title>Request Weblog #Frog.Frog</title>
 <description>OK, now on to the specific &lt;a href="http://www.tbray.org/ongoing/When/200x/2008/08/18/On-REST"&gt;weblog entry&lt;/a&gt; on which Rachel asked me for my thoughts. These are mostly based on the work I've done designing and building services since &lt;i&gt;RWS&lt;/i&gt; was published.

&lt;p&gt;&lt;i&gt;"Has REST Been Fortunate in Its Enemies?"&lt;/i&gt; I really hope the whole "enemies" thing goes away and that the period 2000-2005 is seen in retrospect as a big misunderstanding. Just in the period since &lt;i&gt;RWS&lt;/i&gt; was published there have been really interesting developments (OAuth, PATCH) that have advanced the state of the HTTP art, and we lost five years of that kind of thing going down the wrong path and then having a huge argument about which path was right. That said, when your enemies turn out to be big corporations with lots of money (as always seems to happen to me), I would not describe the situation as fortunate. 

&lt;p&gt;&lt;i&gt;Schema-driven mapping:&lt;/i&gt; probably hopeless if you want a really detailed mapping to plug-and-chug into your strongly-typed language. Even if possible, very boring. Not too difficult if you just want an index that points out the interesting parts of a document.

&lt;p&gt;&lt;i&gt;Contracts:&lt;/i&gt; My personal crackpot theory that I can't get anyone to believe is that &lt;a href="http://www.crummy.com/2007/06/04/0"&gt;hypermedia &lt;i&gt;is&lt;/i&gt; contracts&lt;/a&gt;. A link or form is a promise that if you make a certain HTTP request, you'll get a certain result. HTML is a primitive contract language. The AtomPub service document format and WADL are more advanced contract languages. That said, I think contracts are less useful than often supposed, because the ELIZA effect artificially narrows the distance between the syntax of the contract document and its semantics. An AtomPub service document works like magic because a human programmer did some work beforehand understanding the AtomPub standard and programming in the semantics.

&lt;p&gt;&lt;i&gt;Registries&lt;/i&gt;: We have registries on the human web; we should be able to have them for web services. How much of their imagined benefit is due to the ELIZA effect? How much work will a human need to put in to find the one of 10000 AtomPub implementations they want to post to? I don't know. It depends on the conventions and standards we come up with.

&lt;p&gt;&lt;i&gt;Payload wrappers:&lt;/i&gt; HTTP is a sufficient payload wrapper for my needs, and if I ran into a problem with it I'd extend it (a la OAuth), not that I feel competent to do that. I can kind of see how you'd consider Atom a payload wrapper, but I'm just a simple caveman and I prefer to think of it as a representation format.

&lt;p&gt;&lt;i&gt;Message-level signing and security:&lt;/i&gt; yes! to the former. OAuth works for me. I don't know if I'd ever use message-level security. In general, experimentation is good when it happens on top of HTTP where everyone can use the new standards. 

&lt;p&gt;&lt;i&gt;"Is Getting HTTP Right Good Enough?"&lt;/i&gt; No, not in the way we mean "HTTP" when we have this never-ending argument about verbs. I don't even think it's the first step. The first step is to expose resources: to give a distinct URI to every object you want to publish. That's the first of the RESTful rehabilitation suggestions on page 303 of &lt;i&gt;RWS&lt;/i&gt;. That's the first three steps of the ROA design procedure on page 148. The first document to understand is not the Fielding thesis, not RFC 2616, not even &lt;i&gt;RWS&lt;/i&gt;, it's &lt;a href="http://www.w3.org/TR/webarch/"&gt;Architecure of the World Wide Web, Volume One&lt;/a&gt;. That document is mostly about URIs. HTTP shows up as a URI scheme and as a popular protocol for dereferencing URIs.

&lt;p&gt;This is why Flickr and del.icio.us put up terribly-designed web services and people love them and use them all the time: they stick URIs on everything. People love URIs! Their problem with those services is they don't know when to stop. So the first step is to &lt;i&gt;get on the web&lt;/i&gt;, to not ignore the intuitively obvious usefulness of URIs. It's terrible that these web services self-identify as "RESTful", but at least they've taken the first step.

&lt;p&gt;The second step is to know when to stop handing out URIs. Picking a vocabulary lets you move some of the information out of the URI and into the HTTP method. It lets you expose objects that have methods, instead of a big C library of del.icio.us or Flickr-style functions. This is the step where you master HTTP. This is where the arguments are happening right now. These arguments are not based on intuitively obvious things. They're arguments about scalability and fiasco avoidance and client and network capabilities. They're also arguments about whether using all of HTTP would improve the Web.

&lt;p&gt;The third step is the mastery of hypermedia. (Note that there's one step for each of the Web technologies: URI, HTTP, HTML.) This is about making it possible to program a computer to do the mapping of options to actions that happens in our brains when we surf the web. The advantage here is the same as in the other steps: loose coupling and flexibility. This is the part that confuses everybody, because we don't usually write programs like this unless we're scripting or screen-scraping. And the ELIZA effect is in play, because we've moved past HTTP requests and responses to what happens inside us when we look at response N and decide to make request N+1.

&lt;p&gt;To the extent that there is a "religious" aspect to RESTful thinking, I think it's on this level, in the intuition that there's something in the high-level way we use the Web that we can use when programing a client. Maybe it will turn out to be a bust like AI in the 80s. I've had some encouraging results on my current project. I think it's likely that we're only now figuring this out because we spent five years arguing over whether to use URIs and then another three arguing over whether to use GET/POST or GET/POST/PUT/DELETE.</description>
 <pubDate>Tue, 19 Aug 2008 15:52:38 GMT</pubDate>
 <category domain="http://www.crummy.com/nb/nb.cgi/category/nycb/">rest</category>
 <guid isPermaLink="true">http://www.crummy.com/2008/08/19/0</guid>
</item>
<item>
 <title>Request Weblog #Frog: REST Request</title>
 <description>I wasn't going to get involved in the latest &lt;a href="http://www.tbray.org/ongoing/When/200x/2008/08/18/On-REST"&gt;REST brouhaha&lt;/a&gt; because... well, because I've had to deal with nearly-identical brouhaha at work, and I'm kind of tired of it. But Rachel Chalmers asked for my thoughts, and I have a conference talk I need to start thinking about, so sure.

&lt;p&gt;It looks like this is going to be a multi-part entry, so here is the single most important point I'd like to make. I mentioned it &lt;a href="http://www.crummy.com/2007/06/12/0"&gt;here, last year&lt;/a&gt;, and also mentioned it in &lt;i&gt;RESTful Web Services&lt;/i&gt; (see especially pages 220-221), though not as prominently as I probably should've. Maybe I'll work this here into the second edition.

&lt;p&gt;REST says you should use a uniform interface, but &lt;i&gt;it doesn't say which one&lt;/i&gt;. How do you choose? You pick a set of verbs that 1) gives you the semantics you need for your application, and 2) lets you tie into network effects.

&lt;p&gt;On one end there's the degenerate uniform interface of XML-RPC and SOAP: &lt;b&gt;[POST]&lt;/b&gt;. Like a language with only one word, this is pretty useless. Seeing that "POST" gives you absolutely no information. POST means: "whatever!" You're just pushing the complexity somewhere else. 

&lt;p&gt;The one thing I want to say about this degenerate vocabulary is that your decision to use it is orthogonal to your decisions about resource design. XML-RPC and SOAP services provide a single "endpoint" resource, a monster message-processor at a single URL that responds to a wide variety of POST requests. That's bad resource design. But you could expose a tiny "message processor" for every part of your application you want clients to manipulate, and have them serve hypermedia documents (in response to POST) that linked these resources together. (See &lt;i&gt;RWS&lt;/i&gt; page 303.) It would just suck, because clients could only communicate with those resources through POST.

&lt;p&gt;Then there's the uniform interface of the human web: &lt;b&gt;[GET POST]&lt;/b&gt;. Now that there are two verbs, you can give them separate meanings and split the complexity. GET means "read data" and POST means "change data." Actually, POST still means "whatever!" but since it's defined in opposition to GET, it's convenient to think of it as the opposite of GET.

&lt;p&gt;Choose this set of verbs and you can perform a series of nifty optimizations on GET, which probably make up the bulk of your requests anyway. The GET optimizations work because GET means something. Its meaning is constrained, and constraints can be starting points for optimizations.

&lt;p&gt;But, now that the words have real meanings, they can be misused. Use of GET where you mean POST will make you a victim of the next Google Web Accelerator type fiasco. Use of POST where you mean GET will ruin addressability and annoy your users.

&lt;p&gt;And again, your decision about vocabulary is orthogonal to your decisions about resource design. Whence my rule of thumb: &lt;a href="http://www.crummy.com/2007/06/12/0"&gt;"POST to the same place you GET."&lt;/a&gt; If you had well-designed resources that responded to the degenerate vocabulary of [POST], you could convert your "read data" operations to GET and get a much better web service without changing your resource design. (again, see &lt;i&gt;RWS&lt;/i&gt; page 303.)

&lt;p&gt;Moving further down the scale of complexity is the uniform interface most often seen in discussions of REST: &lt;b&gt;[GET POST PUT DELETE]&lt;/b&gt;. This vocabulary isolates certain classes of "change data" operations, rips them out of POST, and gives them their own names. POST still means "whatever!" 

&lt;p&gt;Why would we do this? Splitting out PUT and DELETE means giving them a meaning distinct from "whatever!" And a meaning is a set of constraints, and you can optimize around constraints, etc. Your decision to use this vocabulary is a decision about which constraints are useful.

&lt;p&gt;And for the third time this is orthogonal to resource design. If you had a RESTful web service that used GET and POST for everything, you could PUTify any POST operations that fit the PUT constraints, DELETEify any operations that fit the DELETE constraints, and then you'd have a four-verb RESTful service. You could go the other way, too: fold PUT and DELETE back into POST and you'd have a RESTful two-verb service. What you'd lose is the ability to say, "make sure the state of the resource reflects the submitted document" or "make sure the resource goes away", instead of "whatever!"

&lt;p&gt;A little more complex is the uniform interface we used throughout &lt;i&gt;RWS&lt;/i&gt;. We use &lt;b&gt;the same four verbs&lt;/b&gt;, but we told POST to stop meaning "whatever!" When we use POST, it's only allowed to mean "create a new resource underneath this one." We did this because "whatever!" is a linguistic rug under which to sweep things. If you write a book about home organization where you say "and here's how to sweep anything inconvenient under the rug!", readers will suspect that there are systemic flaws in your organization techniques. So we wrote a book where we organized complex things like queues and transaction systems without recourse to "whatever!"

&lt;p&gt;But on a technical level, the point is not that "whatever!" is evil. The point is that if you chip a piece off "whatever!" and make it mean something specific, you can optimize around the constraints and reap the benefits. It's pretty clear from the history of the web that you need to separate "read data" out from "whatever!" Because there's less history, there's active disagreement about the cost/benefit tradeoffs of PUT, DELETE, PATCH, et al., though I find them very useful. But the vocabulary you use is an interoperability shibboleth, not a RESTfulness shibboleth.
</description>
 <pubDate>Mon, 18 Aug 2008 23:20:49 GMT</pubDate>
 <category domain="http://www.crummy.com/nb/nb.cgi/category/nycb/">rest</category>
 <guid isPermaLink="true">http://www.crummy.com/2008/08/18/0</guid>
</item>
 </channel>
</rss>
