<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Boardmad &#187; REST</title>
	<atom:link href="http://www.boardmad.com/tag/rest/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.boardmad.com</link>
	<description></description>
	<lastBuildDate>Mon, 06 Feb 2012 07:22:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Need some REST ?</title>
		<link>http://www.boardmad.com/2008/08/13/need-some-rest/</link>
		<comments>http://www.boardmad.com/2008/08/13/need-some-rest/#comments</comments>
		<pubDate>Wed, 13 Aug 2008 12:49:44 +0000</pubDate>
		<dc:creator>Scott Brown</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[roy fielding]]></category>

		<guid isPermaLink="false">http://www.boardmad.com/?p=130</guid>
		<description><![CDATA[I&#8217;ve been working recently on a couple of pretty interesting aspects of MI Reporting in my day job&#8230;you know the stuff about how our organisation generates reports or information or data for our customers to get at in a timely manner. So while researching and reading up on more interactive connectivity and programmatic access to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working recently on a couple of pretty interesting aspects of MI Reporting in my day job&#8230;you know the stuff about how our organisation generates reports or information or data for our customers to get at in a timely manner.</p>
<p>So while researching and reading up on more interactive connectivity and programmatic access to our data in a consumer-agnostic fashion I&#8217;ve been delving into the world of SOAP, RPC and the like. And I came across this brilliant, brilliant explanation of REST. Enjoy !</p>
<p><span id="more-130"></span></p>
<p><strong>Wife:</strong> Who is <q><a href="http://www.ics.uci.edu/%7Efielding/">Roy Fielding</a></q>?</p>
<p><strong>Ryan:</strong> Some guy. He&#8217;s smart.</p>
<p><strong>Wife:</strong> Oh? What did he do?</p>
<p><strong>Ryan:</strong> He <a href="http://1997.webhistory.org/www.lists/www-talk.1994q2/1072.html">helped  write the first web servers</a> and then did <a href="http://www.ics.uci.edu/%7Efielding/pubs/dissertation/top.htm">a ton of  research</a> explaining why the web works the way it does. <a href="http://www.w3.org/Protocols/rfc2616/rfc2616.html">His name is on the  specification</a> for the protocol that is used to get pages from servers to  your browser.</p>
<p><strong>Wife:</strong> How does it work?</p>
<p><strong>Ryan:</strong> The web?</p>
<p><strong>Wife:</strong> Yeah.</p>
<p><strong>Ryan:</strong> Hmm. Well, it&#8217;s all pretty amazing really. And the  funny thing is that it&#8217;s all very undervalued. The protocol I was talking about,  HTTP, it&#8217;s capable of all sorts of neat stuff that people ignore for some  reason.</p>
<p><strong>Wife:</strong> You mean <q>http</q> like the beginning of what I type  into the browser?</p>
<p><strong>Ryan:</strong> Yeah. That first part tells the browser what protocol  to use. That stuff you type in there is one of the most important breakthroughs  in the history of computing.</p>
<p><strong>Wife:</strong> Why?</p>
<p><strong>Ryan:</strong> Because it is capable of describing the location of  something anywhere in the world <em>from</em> anywhere in the world. It&#8217;s the  foundation of the web. You can think of it like GPS coordinates for knowledge  and information.</p>
<p><strong>Wife:</strong> For web pages?</p>
<p><strong>Ryan:</strong> For anything really. That guy, Roy Fielding, he talks  a lot about what those things point to in that research I was talking about. The  web is built on an architectural style called <q><a href="http://en.wikipedia.org/wiki/Representational_State_Transfer">REST</a></q>.  REST provides a definition of a <q>resource</q>, which is what those things  point to.</p>
<p><strong>Wife:</strong> A web page is a resource?</p>
<p><strong>Ryan:</strong> Kind of. A web page is a <q>representation</q> of a  resource. Resources are just concepts. URLs&#8211;those things that you type into the  browser&#8230;</p>
<p><strong>Wife:</strong> I know what a URL is..</p>
<p><strong>Ryan:</strong> Oh, right. Those tell the browser that there&#8217;s a  concept somewhere. A browser can then go ask for a specific representation of  the concept. Specifically, the browser asks for the web page representation of  the concept.</p>
<p><strong>Wife:</strong> What other kinds of representations are there?</p>
<p><strong>Ryan:</strong> Actually, representations is one of these things that  doesn&#8217;t get used a lot. In most cases, a resource has only a single  representation. But we&#8217;re hoping that representations will be used more in the  future because there&#8217;s a bunch of new formats popping up all over the place.</p>
<p><strong>Wife:</strong> Like what?</p>
<p><strong>Ryan:</strong> Hmm. Well, there&#8217;s this concept that people are  calling <q>Web Services</q>. It means a lot of different things to a lot of  different people but the basic concept is that machines could use the web just  like people do.</p>
<p><strong>Wife:</strong> Is this another robot thing?</p>
<p><strong>Ryan:</strong> No, not really. I don&#8217;t mean that machines will be  sitting down at the desk and browsing the web. But computers can use those same  protocols to send messages back and forth to each other. We&#8217;ve been doing that  for a long time but none of the techniques we use today work well when you need  to be able to talk to all of the machines in the entire world.</p>
<p><strong>Wife:</strong> Why not?</p>
<p><strong>Ryan:</strong> Because they weren&#8217;t designed to be used like that.  When Fielding and his buddies started building the web, being able to talk to  any machine anywhere in the world was a primary concern. Most of the techniques  we use at work to get computers to talk to each other didn&#8217;t have those  requirements. You just needed to talk to a small group of machines.</p>
<p><strong>Wife:</strong> And now you need to talk to all the machines?</p>
<p><strong>Ryan:</strong> Yes &#8211; and more. We need to be able to talk to all  machines about all the stuff that&#8217;s on all the other machines. So we need some  way of having one machine tell another machine about a resource that might be on  yet another machine.</p>
<p><strong>Wife:</strong> What?</p>
<p><strong>Ryan:</strong> Let&#8217;s say you&#8217;re talking to your sister and she wants  to borrow the sweeper or something. But you don&#8217;t have it &#8211; your Mom has it. So  you tell your sister to get it from your Mom instead. This happens all the time  in real life and it happens all the time when machines start talking too.</p>
<p><strong>Wife:</strong> So how do the machines tell each other where things  are?</p>
<p><strong>Ryan:</strong> The URL, of course. If everything that machines need  to talk about has a corresponding URL, you&#8217;ve created <em>the machine equivalent  of a noun</em>. That you and I and the rest of the world have agreed on talking  about nouns in a certain way is pretty important, eh?</p>
<p><strong>Wife:</strong> Yeah.</p>
<p><strong>Ryan:</strong> Machines don&#8217;t have a universal noun &#8211; that&#8217;s why they  suck. Every programming language, database, or other kind of system has a  different way of talking about nouns. That&#8217;s why the URL is so important. It  let&#8217;s all of these systems tell each other about each other&#8217;s nouns.</p>
<p><strong>Wife:</strong> But when I&#8217;m looking at a web page, I don&#8217;t think of  it like that.</p>
<p><strong>Ryan:</strong> Nobody does. Except Fielding and handful of other  people. That&#8217;s why machines still suck.</p>
<p><strong>Wife:</strong> What about verbs and pronouns and adjectives?</p>
<p><strong>Ryan:</strong> Funny you asked because that&#8217;s another big aspect of  REST. Well, verbs are anyway.</p>
<p><strong>Wife:</strong> I was just joking.</p>
<p><strong>Ryan:</strong> It was a funny joke but it&#8217;s actually not a joke at  all. Verbs are important. There&#8217;s a powerful concept in programming and CS  theory called <q>polymorphism</q>. That&#8217;s a geeky way of saying that different  nouns can have the same verb applied to them.</p>
<p><strong>Wife:</strong> I don&#8217;t get it.</p>
<p><strong>Ryan:</strong> Well.. Look at the coffee table. What are the nouns?  Cup, tray, newspaper, remote. Now, what are some things you can do to all of  these things?</p>
<p><strong>Wife:</strong> I don&#8217;t get it&#8230;</p>
<p><strong>Ryan:</strong> You can <em>get</em> them, right? You can pick them  up. You can knock them over. You can burn them. You can apply those same exact  verbs to any of the objects sitting there.</p>
<p><strong>Wife:</strong> Okay&#8230; so?</p>
<p><strong>Ryan:</strong> Well, that&#8217;s important. What if instead of me being  able to say to you, &#8220;get the cup,&#8221; and &#8220;get the newspaper,&#8221; and &#8220;get the  remote&#8221;; what if instead we needed to come up with different verbs for each of  the nouns? I couldn&#8217;t use the word &#8220;get&#8221; universally, but instead had to think  up a new word for each verb/noun combination.</p>
<p><strong>Wife:</strong> Wow! That&#8217;s weird.</p>
<p><strong>Ryan:</strong> Yes, it is. Our brains are somehow smart enough to  know that the same verbs can be applied to many different nouns. Some verbs are  more specific than others and apply only to a small set of nouns. For instance,  I can&#8217;t drive a cup and I can&#8217;t drink a car. But some verbs are almost universal  like <code>GET</code>, <code>PUT</code>, and <code>DELETE</code>.</p>
<p><strong>Wife:</strong> You can&#8217;t <code>DELETE</code> a cup.</p>
<p><strong>Ryan:</strong> Well, okay, but you can throw it away. That was  another joke, right?</p>
<p><strong>Wife:</strong> Yeah.</p>
<p><strong>Ryan:</strong> So anyway, HTTP&#8211;this protocol Fielding and his  friends created&#8211;is all about applying verbs to nouns. For instance, when you go  to a web page, the browser does an HTTP <code>GET</code> on the URL you type in  and back comes a web page.</p>
<p>Web pages usually have images, right? Those are separate resources. The web  page just specifies the URLs to the images and the browser goes and does more  HTTP GETs on them until all the resources are obtained and the web page is  displayed. But the important thing here is that very different kinds of nouns  can be treated the same. Whether the noun is an image, text, video, an mp3, a  slideshow, whatever. I can GET all of those things the same way given a URL.</p>
<p><strong>Wife:</strong> Sounds like GET is a pretty important verb.</p>
<p><strong>Ryan:</strong> It is. Especially when you&#8217;re using a web browser  because browsers pretty much just <code>GET</code> stuff. They don&#8217;t do a lot of  other types of interaction with resources. This is a problem because it has led  many people to assume that HTTP is just for <code>GET</code>ing. But HTTP is  actually a <em>general purpose protocol for applying verbs to nouns</em>.</p>
<p><strong>Wife:</strong> Cool. But I still don&#8217;t see how this changes anything.  What kinds of nouns and verbs do you want?</p>
<p><strong>Ryan:</strong> Well the nouns are there but not in the right  format.</p>
<p>Think about when you&#8217;re browsing around amazon.com looking for things to buy  me for Christmas. Imagine each of the products as being nouns. Now, if they were  available in a representation that a machine could understand, you could do a  lot of neat things.</p>
<p><strong>Wife:</strong> Why can&#8217;t a machine understand a normal web page?</p>
<p><strong>Ryan:</strong> Because web pages are designed to be understood by  people. A machine doesn&#8217;t care about layout and styling. Machines basically just  need the data. Ideally, every URL would have a human readable and a machine  readable representation. When a machine <code>GET</code>s the resource, it will  ask for the machine readable one. When a browser <code>GET</code>s a resource  for a human, it will ask for the human readable one.</p>
<p><strong>Wife:</strong> So people would have to make machine formats for all  their pages?</p>
<p><strong>Ryan:</strong> If it were valuable.</p>
<p>Look, we&#8217;ve been talking about this with a lot of abstraction. How about we  take a real example. You&#8217;re a teacher &#8211; at school I bet you have a big computer  system, or three or four computer systems more likely, that let you manage  students: what classes they&#8217;re in, what grades they&#8217;re getting, emergency  contacts, information about the books you teach out of, etc. If the systems are  web-based, then there&#8217;s probably a URL for each of the nouns involved here:  student, teacher, class, book, room, etc. Right now, getting the URL through the  browser gives you a web page. If there were a machine readable representation  for each URL, then it would be trivial to latch new tools onto the system  because all of that information would be consumable in a standard way. It would  also make it quite a bit easier for each of the systems to talk to each other.  Or, you could build a state or country-wide system that was able to talk to each  of the individual school systems to collect testing scores. The possibilities  are endless.</p>
<p>Each of the systems would get information from each other using a simple HTTP  <code>GET</code>. If one system needs to add something to another system, it  would use an HTTP <code>POST</code>. If a system wants to update something in  another system, it uses an HTTP <code>PUT</code>. The only thing left to figure  out is what the data should look like.</p>
<p><strong>Wife:</strong> So this is what you and all the computer people are  working on now? Deciding what the data should look like?</p>
<p><strong>Ryan:</strong> Sadly, no. Instead, the large majority are busy  writing layers of complex specifications for doing this stuff in a different way  that isn&#8217;t nearly as useful or eloquent. Nouns aren&#8217;t universal and verbs aren&#8217;t  polymorphic. We&#8217;re throwing out decades of real field usage and proven technique  and starting over with something that looks a lot like other systems that have  failed in the past. We&#8217;re using HTTP but only because it helps us talk to our  network and security people less. We&#8217;re trading simplicity for flashy tools and  wizards.</p>
<p><strong>Wife:</strong> Why?</p>
<p><strong>Ryan:</strong> I have no idea.</p>
<p><strong>Wife:</strong> Why don&#8217;t you say something?</p>
<p><strong>Ryan:</strong> Maybe I will.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.boardmad.com/2008/08/13/need-some-rest/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	<!-- <a href="http://www.boardmad.com/contacts">Private</a> --></channel>
</rss>

