<?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>Technology of Content &#187; REST</title>
	<atom:link href="http://blog.technologyofcontent.com/tag/rest/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.technologyofcontent.com</link>
	<description>Ramblings on the technology of content management</description>
	<lastBuildDate>Sun, 29 Jan 2012 16:38:05 +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>Utility Computing, or will the real cloud please get off its *AAS</title>
		<link>http://blog.technologyofcontent.com/2011/03/utility-computing-or-will-the-real-cloud-please-get-off-its-aas/</link>
		<comments>http://blog.technologyofcontent.com/2011/03/utility-computing-or-will-the-real-cloud-please-get-off-its-aas/#comments</comments>
		<pubDate>Mon, 28 Mar 2011 22:04:48 +0000</pubDate>
		<dc:creator>justin</dc:creator>
				<category><![CDATA[cloud]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[history]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[utility compputing]]></category>

		<guid isPermaLink="false">http://blog.technologyofcontent.com/?p=306</guid>
		<description><![CDATA[Thanks to Dave Nielsen and Simon Wardley for evangelizing Douglas Parkhill and the history of cloud; this is quite a historical post after digging around books and writing Wikipedia articles. A lot of things are changing with the way we buy, sell, write and use software at the moment. We do live in very interesting [...]]]></description>
			<content:encoded><![CDATA[<p><em>Thanks to <a href="http://twitter.com/davenielsen">Dave Nielsen</a> and <a href="http://twitter.com/swardley">Simon Wardley</a> for evangelizing Douglas Parkhill and the history of cloud; this is quite a historical post after digging around books and writing Wikipedia articles.</em></p>

<p>A lot of things are changing with the way we buy, sell, write and use software at the moment. We do live in very interesting times. The big umbrella movement called cloud is one of the most interesting things; for example there is a huge shift to on demand software and hardware, ideal for the agility it enables, as well as disintermediating expensive sales processes.</p>

<p>Hardware started commoditising a long time back, with the huge economies of scale in chipmaking and computers, but wheat has really hit is the 2005 shock when <a href="http://www.gotw.ca/publications/concurrency-ddj.htm">clock speeds hit the ceiling</a> and Moore&#8217;s Law just went into more cores. Scale out was the only real option then for performance, although JIT compiler technology has been a hot topic, and if you program in some dynamic languages like Javascript you might be forgiven for thinking computers were still getting significantly faster. Simultaneously simpler lower power devices have been shifting up the performance curve, reaching a point where some people are starting to <a href="http://www.calxeda.com/">seriously build ARM servers</a>, and mobile devices are reaching useful performance for wide ranging tasks.</p>

<p>Many thought that at this point we would be programming SMP architectures with shared memory models, but while you can now get systems with very large number of cores in the SMP/NUMA world, but these are very expensive systems, and little software outside specialist areas. The majority of multisocket systems now are probably virtualized to appear as multiple single socket ones. Scale out, message passing, commodity hardware are mostly where things are, with a sideshow of commoditized GPU technology giving us another parallelism to work with, or another competitor to the ageing x86 architecture. China is building its own <a href="http://en.wikipedia.org/wiki/Loongson">MIPS64</a> based CPU too, designed to run Linux, more competition to lower prices. Computation, networking, storage are all getting very cheap.</p>

<p>I replaced my last dual socket 2GHz powerpc machine with a new dual core machine thats a fair bit faster but about 10-20% of the power consumption, and now almost all the ten or so computers around the house are small, low power, and dedicated to one function: netbook, 2 mobile phones, ipad, VOIP phone, router, storage, laptop, a couple of small computers. The highest power consumption is probably the old laptop, a last reminder of the old Intel that used to make chips up to 100W. It makes no sense for me to invest in large amounts of computer power in the home, because the bandwidth is not there: it takes too long to get larger datasets here, so I try to do computation where the data is and where there is bandwidth, so I outsource the computing.</p>

<p>When <a href="http://en.wikipedia.org/wiki/Douglas_Parkhill">Douglas Parkhill</a> wrote The Challenge of the Computer Utility in 1966, while working at the sinisterly capitalized <a href="http://www.mitre.org/">MITRE</a>, the reason for people to be interested in computers as utilities was the expense of actually owning a computer, which cost around $2m at the time, but could be rented at $450 an hour. But the economics of treating computers as a utility, improved utilisation, availability on demand are just as valid now, as well as the ability to shorten development feedback times and share common source code which he also cites. Utilities are largely centralised for reasons of economy of scale, ease of balancing changing demand, and ability to provide large quantities. Obviously some people have their own generators or solar cells and water supplies, and some people and companies sell power into the grid, but the majority comes from large sources, using varying technologies.</p>

<p>Other than PCs, which are increasingly mobile, most businesses don&#8217;t keep a lot of computing power on premise, most of it is in datacentres. And those datacentres are increasingly getting larger and further away, as the cost of power and real estate pushes them to cheaper locations. And they get bigger for cooling efficiency reasons, and start to turn into billion dollar projects, vastly more expensive in real terms than the computers of 1966. On demand computing suddenly starts to make sense for almost all businesses who do not wish to get into this type of expenditure. It also suddenly makes computation costs transparent, in terms of how much computation or accuracy is cost effective for a particular task, even if killing fixed cost budgeting is going to massively disrupt the financial planning of enterprises (another change that will need more computing power to manage).</p>

<h2>What does a computer utility look like?</h2>

<p><figure>
<img src="http://public.edge3.org/Brush_central_power_station_dynamos_New_York_1881.jpg" alt="Brush electric light station in New York, 1880s">
<figcaption><a href="http://en.wikipedia.org/wiki/Charles_F._Brush">Victorian sysadmins</a></figcaption>
</figure></p>

<p>The early days of utilities are dominated by several issues, one being standardization, whether it be <a href="http://en.wikipedia.org/wiki/Mains_electricity#History_of_voltage_and_frequency">AC frequency and voltage</a>, another being technological change, as from hollowed out trees, to clay pipes to plastic in water transmission, or financial boom and bust of the railway industry as the level of demand and supply were balanced out. Competition between new utilities and old ones was also significant, railways vs canals, roads vs railways, gas lighting vs electricity, hydraulic power vs electric power, and regulatory and legal issues from compulsory purchase, nationalisation and especially <a href="http://en.wikipedia.org/wiki/Munn_v._Illinois">price regulation</a>.</p>

<p>In the end though, the centralized delivery model means you end up with standardized services being delivered, you cannot choose the voltage and frequency you want your electricity delivered (other than wholesale bulk offerings, like three phase), the temperature or pressure of the tap water, the frequency of the trains, or the level of congestion on the roads. Utilities often have slightly odd externalities and natural distribution monopolies that vary from one to another.</p>

<p>Computer software architectures are very non standardized right now, as we are in the craft period of software. There is a lot more standardization than in 1966, when there was less mass production, and LSI was only just starting. Common abstractions have been slowly appearing, virtual memory being an early one in the <a href="http://en.wikipedia.org/wiki/Burroughs_large_systems">B5000 in 1961</a>, hiding the memory hierarchy in a way that simplifies a lot of code, even if other code needs to understand the abstraction for performance; that was around the same time that high level languages were being developed with mutable variables that matched the semantics of virtual memory. The next big abstraction, from the late 1960s, was the <a href="http://en.wikipedia.org/wiki/Unix">Unix</a> (almost) everything is a file model, a universal stream processing model for many types of data and connections with a single software interface, which also allowed compositional software. In 1970 <a href="http://en.wikipedia.org/wiki/Edgar_F._Codd">Codd</a> created the relational data model, an abstraction for databases. It was a productive time, in which <a href="http://en.wikipedia.org/wiki/Paul_Baran">Paul Baran</a> also invented the packet switched network made of unreliable components, another key building block of the cloud architecture. In the 1970s we had the language virtual machine, starting with the <a href="http://en.wikipedia.org/wiki/UCSD_Pascal">UCSD p-System</a> which heavily influenced Java, the beginning of virtualisation of hardware and operating system characteristics that has had some, although still arguably limited, success and standardisation.</p>

<p>The characteristics of a utility architecture are those embodied in the internet: distributed, failure tolerant (up to a limit of course, we still get water and electricity outages, with very weak SLAs), standardised interfaces (plug sockets, HTML), usage agnostic, scalable. In particular the six constraints of the <a href="http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm">REST architectural style</a>, client-server, stateless, cacheable, layered, optional code on demand, uniform interfaces currently give us our best architectural model of a scaleable, on-demand system, and so our best model of what the abstractions of a truly utility infrastructure will look like. Another characteristic is of course the use of open source software, which represents both the commoditisation of infrastructure software, and the right price for utility and on demand scaleable software.</p>

<p><a href="http://www.flickr.com/photos/justincormack/4158836526/" title="Homage to Bernd and Hiller Becher (blue period) by Justin Cormack, on Flickr"><img src="http://farm3.static.flickr.com/2580/4158836526_ba83849e19_m.jpg" width="171" height="240" alt="Homage to Bernd and Hiller Becher (blue period)" /></a></p>

<h2>Current environments</h2>

<p>If we look at Amazon web services, the closest thing so far to a utility computing service (although with some transitional facilities bolted on), the storage abstraction, S3, looks pretty much like what we would expect from the REST style, resource based, supporting the HTTP concurrency model (etags, conditional updates); note it looks nothing like a POSIX file system, the previous abstraction. In the Amazon model, this is the only really persistent, reliable, scaleable, global storage. Other services like EBS are <a href="http://www.elasticvapor.com/2010/05/failure-as-service.html">not fully reliable</a> but can be snapshotted to S3, while SimpleDB is not really a database in the persistence sense, as it has severe limits on size and is not globally available; it is better seen as an abstract index, fulfilling that part of the database requirements without the persistence. Other storage such as local disks is even more ephemeral. I have another blog post in the works on how best to use these persistence models for real applications.</p>

<p>The network architectures in Amazon are similarly what you would expect for building REST architectures, with load balancers and an HTTP cache layer for example. In contrast, Amazon&#8217;s EC2 provides a Xen virtualised PC as the base abstraction which is pretty software architecture agnostic, compared to say Google App Engine, which provides an abstracted language runtime. The more general platform allows more experimentation, and crucially more legacy transition. We have a lot of historic usage of operating systems, security models, coding habits and <a href="http://natishalom.typepad.com/nati_shaloms_blog/2011/03/productivity-vs-control-tradeoffs-in-paas.html">productivity issues</a> that make using &#8220;opinionated platforms&#8221; difficult.</p>

<p>In many ways though, whether the API provided on a utility compute resource is the <a href="http://www.oracle.com/technetwork/java/javaee/servlet/index.html">Java servlet standard</a> as in the <a href="http://code.google.com/appengine/docs/whatisgoogleappengine.html">GAE Java environment</a> or virtual network devices as in EC2, thats really a middleware question, and a question of the amount of environment you have to wrap around your code. The Amazon approach encourages people to repackage services for different language communities on top of their offering. The important parts of the architecture are the parts that support failure, scale, reliability. The most important one of these, often neglected, is explicit management of state. The <a href="http://blog.worldturner.com/worldturner/entry/stateless_computing">server itself</a> must be <a href="http://www.infoq.com/presentations/Runtime-Changes">stateless if it is to be failure proof</a>. All state must be managed in the persistent storage abstraction, and software upgrades by starting up new machines, and upgradeable interface specifications, another REST idea. This is a big cultural leap for people, apart from not being used to actually accounting for every data change the program makes, sysadmins are used to patching systems at runtime, rather than starting up new, tested, instances when code needs to be updated. Unless state is explicit it is not testable or reliable, or known, or recoverable. These things were discovered of course in the <a href="http://www.infoq.com/presentations/Systems-that-Never-Stop-Joe-Armstrong">Erlang community</a> where backups are a sign of poorly designed systems that have not covered all the failure cases properly. More on this side of things in other posts soon too.</p>

<p>Once you have realised that there is only scale-out, all state must be explicitly managed in state abstractions, and failure must be designed for all over, the container shape makes much less difference, as your software architecture will be very similar. Sure there are points of difference, packets versus streams say, sync vs async, different security architectures, different programming languages, protocols, serializations and libraries. The network is really the only important IO point for the utility computation; the server environment can be much simpler in principle than the complex server environments we run predominantly now, and thus able to scale better on more and more commodity hardware, highly parallel and low power that we were talking about before.</p>

<h2>Beyond Compute and Store</h2>

<p>I said before that Amazon SimpleDB was best viewed as an index not a database, and lots of the software we use in a web environment is like that, key-value stores, memcache, and some of the NoSQL solutions are providing this type of function, not concentrating mainly on persistence; obvious product areas here are things like full text search which are not the ultimate data source. Others are trying to provide &#8220;small item persistence&#8221;, although most of these systems are not yet being aimed at utility computing provision, so they have not tended to cleanly separate store and index for example, and persistence is mainly aimed at hard drives. Given the historical popularity of databases, and the current flourishing of the NoSQL movement, I can see an opportunity for something like Cassandra with an S3-type backend as a utility computing key-value store. Why not SQL? The main problem is the lack of scalability of JOINs; making it difficult to scale as a true elastic utility service. In addition, I can see a place for a low latency reliable transaction log service built on replicated SSD that shifts over automatically to permanent long term storage (please Amazon), to cut the persistence time, especially for small data items.</p>

<p>Other facilities for utility computing include authorization infrastructure, message queues, payment infrastucture and so on, blending into more specialist services sold as SAAS on the infrastructure.</p>

<h2>Beyond Now</h2>

<p>Our current code model looks a bit like running code inside a web server; indeed that is one way to do organize the code, or you can reverse this and run a web library inside the language library, like Node.js does for example. Architectures could change though, perhaps (sometimes) moving the code to the storage for lower latency; the advantage of strongly decoupled code with explicit state management is that it is much easier to move it around; explicit state management with all lasting state over the network has the same properties as functional programming, indeed as we said before is very much like the Erlang functional process and message passing model. This flexibility in where code runs allows another level of infrastructure virtualisation and efficiency, moving code towards requesters or data based on latency and throughput requirements.</p>

<p>I don&#8217;t think this is going to change how programming works a lot, well at least it should be pretty familiar to web programmers, might be some adjustment for the enterprise lot of course. What is going to change is sysadmin. One of the issues now with cloud solutions is they require too much sysadmin to really allow us to scale up our usage. <a href="http://en.wikipedia.org/wiki/Jevon%27s_paradox">Jevon&#8217;s Paradox</a> cannot come into effect and let us expand capacity as price falls if there are additional costs such as admin overhead. The infrastructure providers have managed to cut staff to less than 1 per 4000 machines, but the users of services like Amazon&#8217;s still have a lot of software environment management overhead. I think we can cut that too, substantially, using stateless servers and other changes, but that is another blog post.</p>

<p>This is perhaps a bit of a run through history, trying to make sense of the journey towards utility computing that has been going on for over 45 years but is really just starting to become mainstream, and where we still have the opportunity to build a new utility, which is something that does not happen very often. Some more concrete explorations coming soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.technologyofcontent.com/2011/03/utility-computing-or-will-the-real-cloud-please-get-off-its-aas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Smart resources, or why you should care about HTTP PATCH</title>
		<link>http://blog.technologyofcontent.com/2009/12/smart-resources-or-why-you-should-care-about-http-patch/</link>
		<comments>http://blog.technologyofcontent.com/2009/12/smart-resources-or-why-you-should-care-about-http-patch/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 23:42:06 +0000</pubDate>
		<dc:creator>justin</dc:creator>
				<category><![CDATA[REST]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[PATCH]]></category>

		<guid isPermaLink="false">http://blog.technologyofcontent.com/?p=169</guid>
		<description><![CDATA[Unusually, there has been a significant change to the HTTP protocol this week. The PATCH method was approved by the IETF. This is a big change as one of the parts of the HTTP model is the small &#8220;uniform interface&#8221;, where there are very few things you can do to web resources. GET is the [...]]]></description>
			<content:encoded><![CDATA[<p>Unusually, there has been a significant change to the HTTP protocol this week. The <a href="http://greenbytes.de/tech/webdav/draft-dusseault-http-patch-16.html">PATCH method</a> was approved by the <a href="https://datatracker.ietf.org/drafts/draft-dusseault-http-patch/">IETF</a>.</p>

<p>This is a big change as one of the parts of the HTTP model is the small &#8220;uniform interface&#8221;, where there are very few things you can do to web resources. GET is the most common, to retrieve a resource representation. Then there is PUT to update a resource, and DELETE to delete it. Then there is POST, which tends to cover everything else you might want to do. The problem with that is that discovering the interface for POST is difficult, as is knowing exactly what it will do. (There are a few other verbs too).</p>

<p>PATCH is much more straightforward. PUT updates an entire resource with a new version, while PATCH just makes an amendment to a resource. For some types of resource, the entire resource may be large, so that just sending differences will save bandwidth. Also, sending the full resource may unnecessarily make the changes sequential, for example append operations where the order of the operations is not significant. One example given is a log file, where many processes  may be adding entries, and if they had to retrieve the whole log, append a new entry and write it back there would be a lot of extra traffic, and a chance of either lost updates or processes having to retry if the resource was modified during this process. Clearly a PATCH operation here that does an append would make sense. I am not sure that is actually a very good example though, as you would  almost certainly create a resource for each log entry, rather than one for the whole lot, but clearly other similar patterns exist.</p>

<h2>HTTP is not a filesystem</h2>

<p>When it was new, people tended to treat HTTP like a filesystem. After all that was the common model for storage, and web servers generally stored web pages as files, so they tended to e treated much like that, with filename extensions annd index files, and WEBDAV was created to try to make the web usable as a filesystem protocol. This model does not really work very well however, as it does not model the things you can and can&#8217;t do with HTTP. The methods are one example; updating entire resources at once means they tend to be small units, rather than, for example, log files. File systems generally struggle to store millions of tiny files without wasting a lot of space, and without becoming slower. The web  resource does not have to support full Unix filesystem semantics (a topic that oddly Wikipedia seems to be missing an entry on! May have to rectify that), and supports a much simpler updte model.</p>

<p>Maybe the easist way of thinking about HTTP is to see every URL is a small <a href="http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller">Model View Controller</a> (MVC) system. The model is an abstract resource, which we can see through GET, which retieves views. There can be multiple views, as a request can ask for different media types and encodings for a single resource. The controllers are the media types supported by PUT, which are usually the same as those for GET, but need not be; because both the view and the controller need to represent the whole resource state, they do tend to be quite complex representations, such as XML documents. PATCH however is also a controller, but a more interesting one in many ways, as it can send just state changes to the model, which tends to be how many MVC systems work.</p>

<p>Another thing that PATCH enables is resources that hide some of their state. A resource could only support PATCH and not PUT so that state modifications were only changes. If the state returned by GET is not the complete state, the resource could hide parts of the model. An example could be a voting method that records but does not reveal who has voted, only returning totals, which accepts votes as PATCH requests.</p>

<h2>Server side scripting</h2>

<p>One PATCH format that makes a lot of sense is actually to use executable code, rather than say diff files. There is no reason why you  should not send the server a PATCH request that is some Javascript to modify the DOM of an HTML resource which can be executed serverside, or an XSL transform to modify and XML object. Sending code is an efficient way of making changes to a resource, and can be executed in a sandbox like the browser sandbox. This will be another driving factor for Javascript on the server side, as it is well suited for embedding like this, and already has a DOM model for transforms.</p>

<p>All these changes take us further away from the filesystem model. Web resources will more and more combine some storage with some computation, including ability to execute code in a contolled way. Smart resources will become more common, over dumb storage only resources.</p>

<h2>In other news</h2>

<p>Next in line for HTTP, hopefully, is the <a href="http://tools.ietf.org/html/draft-nottingham-http-link-header-06">Link header</a> which adds a new header for legacy document formats that do not include a native hyperlinking capability. This will allow relationships between these documents to be included in the retrieved resource, such as a link to metadata or other related resources. The HTTP replacement for the file system model is getting serious.</p>

<!--a href="http://geekandpoke.typepad.com/geekandpoke/2009/11/service-calling-made-easy-part-1.htm"><img src="http://geekandpoke.typepad.com/.a/6a00d8341d3df553ef012875f312f9970c-pi" width="400"/></a-->
]]></content:encoded>
			<wfw:commentRss>http://blog.technologyofcontent.com/2009/12/smart-resources-or-why-you-should-care-about-http-patch/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Search APIs with HTTP interfaces</title>
		<link>http://blog.technologyofcontent.com/2009/11/search-apis-with-http-interfaces/</link>
		<comments>http://blog.technologyofcontent.com/2009/11/search-apis-with-http-interfaces/#comments</comments>
		<pubDate>Sat, 28 Nov 2009 22:45:55 +0000</pubDate>
		<dc:creator>justin</dc:creator>
				<category><![CDATA[REST]]></category>
		<category><![CDATA[API]]></category>

		<guid isPermaLink="false">http://blog.technologyofcontent.com/?p=156</guid>
		<description><![CDATA[I had a brief exchange with Erik Wilde or @dret on twitter about REST and query languages; specifically SPARQL and whether the SPARQL DESCRIBE could be made RESTful with GET and PUT. SPARQL DESCRIBE is a somewhat controversial feature of SPARQL that returns an RDF graph &#8220;around&#8221; the query, including all the referenced URIs and [...]]]></description>
			<content:encoded><![CDATA[<p>I had a brief exchange with Erik Wilde or <a href="http://twitter.com/dret">@dret</a> on twitter about REST and query languages; specifically SPARQL and whether the SPARQL DESCRIBE could be made RESTful with GET and PUT.</p>

<p>SPARQL DESCRIBE is a <a href="http://www.w3.org/2001/sw/DataAccess/ftf4.html#item14">somewhat controversial</a> feature of SPARQL that returns an RDF graph &#8220;around&#8221; the query, including all the referenced URIs and some sort of domain specific context. It is less well defined than CONSTRUCT, that also extracts a graph.</p>

<p>But there are not many guidelines for how to actually write useful interfaces for search type functionality for REST web service APIs.</p>

<p>A lot of this applies to other collection type interfaces, collection in the Atom sense, which is essentially a predefined filter rather than one you can submit a query to. Resource collections are a fundamental feature of any real world system, being able to take a set of resources and manipulate it as one. Query languages are generally an efficient way of defining interesting collections.</p>

<p>I do not specifically refer to SPARQL here. Like many of the W3C recommendations, it is XML document oriented in its specification, not HTTP oriented, and so does not try to address the types of issues here. I have some issues with the W3C approach, sidestepping implementation issues; indeed the whole RDF as Prolog wrapped in XML does not seem very productive, and I think a more pragmatic approach from practise will work better, as with some of the other W3C initiatives. Items like DESCRIBE imply much more domain knowledge, and it is unclear what interoperability would mean.</p>

<h2>Whats the problem with query languages and REST?</h2>

<p>The main issues are that a SQL style SELECT should map to an HTTP GET, but instead we are passing a query with another verb in it. One method of avoiding this would be to work with predefined refinement &#8220;queries&#8221; where you could walk through paths of filters from a resource that represents everything. Imagine a faceted navigation system drilling down to construct what becomes a filter query through a selection of refine links (where you might end up with a hierarchical URL in the end not a query document). This might work better in a system with a finite vocabulary, although it could still be navigated via forms potentially. However this starts to work less well with complex nested queries with sorting and limits, and subterms, as the number of opotions is large, and it would be complex to make a comprehensive set of link types to make them understandable (you might just end up tokenizing SQL in links which does not seem elegant).</p>

<h2>REST search and GET queries</h2>

<p>First off, for standard read only GET queries, there is one model that is really useful and is too rarely used. For some reason most search queries in &#8220;REST&#8221; frameworks involve submitting a query as a POST request because the query string would be too long for a GET request. This however generally does not create a resource, it just returns a response, or a temporary response resource. CMIS for example works along these lines. However the sane model along these lines is to submit a query document with POST (or PUT) and have it persistent until DELETEd, and be able to requery as needed. Also, it should be possible to create query resources with unbound variables, which can be used by a system like prepared queries in SQL databases; in particular the creation of these should allow a system to work out perhaps if it needs additional indexes based on the queries that have been created. These can then be evaluated by using query strings to bind the parameters. For some reason you rarely if ever see a query specification for a REST API that has unbound variables in the query, thus missing out on the ability to use this pattern.</p>

<p>Note that the query itself is a resource, so we can for example DELETE the prepared query eg http://example.com/query. There are also resources corresponding to the result sets eg http://example/com/query?q=red.</p>

<p>As well as unbound variables for constants, another missing feature from most query languages (probably because they were not designed for HTTP transport) is the lack of ability to specify a URL that corresponds to a subexpression. This can be considered as another extension of unbound variables; you can also see this as the extension of the labguage to support SQL style views that can themselves be queried. Like a view, you could either use the definition or the current materialized version for performing further queries.</p>

<h2>REST and update queries</h2>

<p>Although it rarely seems to be done, there is no particular reason that once you have a query resource like the ones defined above, you should not be able to DELETE http://example/com/query?q=red to delete all red objects, or PUT a new set of red objects to replace the existing ones. Most collection oriented protocols, such as Atom, do not allow PUT and DELETE methods on collections, only on the member resources. POST is allowed in Atom, to define collection membership; this only makes sense where collection membership cannot be defined by visible properties of a resource; the instruction create this item with whatever properties are needed to put this item in this query result is not necessarily something that works for any domain. Certainly one can think of models in which allowing PUT and DELETE on search results resources would be useful, although there might be issues with paging and large document sizes on some types of resource. PATCH would be a useful addition for doing the equivalent of SQL UPDATE, in order to reduce the document sizes, rather than having to PUT back everything.</p>

<p>There may be other domain issues, and in some systems consistency issues with mass deletion and insertion that mean that actions on individual items not collections are more efficient of course, but extending the uniform HTTP interface to collections should certainly not be ruled out for many domains.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.technologyofcontent.com/2009/11/search-apis-with-http-interfaces/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The resource oriented enterprise followups</title>
		<link>http://blog.technologyofcontent.com/2009/08/the-resource-oriented-enterprise-followups/</link>
		<comments>http://blog.technologyofcontent.com/2009/08/the-resource-oriented-enterprise-followups/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 16:08:31 +0000</pubDate>
		<dc:creator>justin</dc:creator>
				<category><![CDATA[REST]]></category>
		<category><![CDATA[SOA]]></category>

		<guid isPermaLink="false">http://blog.technologyofcontent.com/?p=84</guid>
		<description><![CDATA[Followups after my first post on the resource oriented enterprise.]]></description>
			<content:encoded><![CDATA[<p><em>This is a followup to my earlier post on <a href="http://blog.technologyofcontent.com/2009/08/the-resource-oriented-enterprise/">the resource oriented enterprise</a>, I had some good feedback much from the <a href="http://tech.groups.yahoo.com/group/rest-discuss">REST mailing list</a> which I summarize here. As I said there this is an attempt to get some of these ideas documented as they largely seem to be invisible.</em></p>

<blockquote>
  <p>Only solutions that produce partial results when partially implemented can succeed. The network is littered with ideas that would have worked had everybody adopted them. Evolvable systems begin partially working right away and then grow, rather than needing to be perfected and frozen. <a href="http://www.shirky.com/writings/evolve.html">Clay Shirky</a></p>
</blockquote>

<p>I came across that quote from Clay Shirky as I was writing this which seemed very relevant.</p>

<p><a href="http://www.jalgermissen.com/">Jan Algermissen</a> added the two following very good points:</p>

<blockquote>
  <p>the use of REST brings the decentralization aspects of the Web into the enterprise world and allows designers and developers of networked systems to create and evolve their components without the resource and time consuming effort of bringing them into a single room to discuss APIs. In geographically distributed organizations this might sometimes even be impossible.</p>
  
  <p>the use of REST facilitates fragmented change. It deliberately provides room for evolution (e.g. format extensions) that can bypass the main organizational control. Evolutions that turn out to be valuable can flow back into the main line while others silently die. No harm to ongoing communication between systems is done by either of those.</p>
</blockquote>

<p>These are really very important points. You cannot really undersell the success of the web, and the web took off with its own architecture despite attempts to force other architectures on it. The decentralization and the ability to reuse and mashup services to make new things is part of that architecture. The idea of introducing REST to the enterprise is to help the enterprise leverage the agility of the web architecture, and to make building new enterprise applications cheaper and easier.</p>

<p><a href="http://soundadvice.id.au/blog/">Benjamin Carlyle</a> made the good point that you can view REST as an evolution of SOA, as better easier to consume services. This does not quite fit with my view of history, but I do agree that it is a good way to sell it now as &#8220;SOA on steroids&#8221; as he says. He linked to useful sounding book coming out later this year on <a href="http://soabooks.com/book.asp?book=soa_rest&amp;page=overview">SOA and REST</a>. He examines seven SOA objectives from Thomas Erl&#8217;s book, Principles of Service Design:</p>

<ol>
<li><p>Increased Intrinsic Interoperability</p>

<p>Made better with a uniform interface &#8211; Interoperability stops being an &#8220;easy to plug together at design time&#8221; thing to &#8220;easy to plug together at run-time&#8221;</p></li>
<li><p>Increased Federation</p>

<p>This is not an explicit target of REST, to get everyone using the same service. However, it is compatible with REST. It also occurs in practice on the Web through market forces.</p>

<p>While SOA emphasises reuse of services, REST emphasises reuse of components (including services), media types, and connectors.</p></li>
<li><p>Increased Vendor Diversity Options</p>

<p>More or less the same for SOA and REST, however REST is probably still less mature in the enterprise space. Time will change this.</p></li>
<li><p>Increased Business and Technology Alignment</p>

<p>ie, we build services that the business wants, and can change in pace with business objectives</p>

<p>Again REST doesn&#8217;t particularly target specific valuable services, but is compatible with the notion</p>

<p>REST is more capable of incremental upgrade than a classical SOA, especially &#8220;dynamic evolution&#8221;.</p></li>
<li><p>Increased ROI</p>

<p>Classically realised in SOA by reuse of services, which again is compatible with REST</p>

<p>Again, a uniform interface produces wins on this front when compared to classical SOA</p></li>
<li><p>Increased Organizational Agility</p>

<p>Classically realised by being able to build new applications quickly by reusing existing services</p>

<p>Again, compatible with REST and again a uniform interface produces improved performance</p></li>
<li><p>Reduced IT Burden</p>

<p>Few legacy systems doing more means less maintenance and related support activities &#8211; again compatible with REST.</p>

<p>REST makes maintenance easier with its focus on dynamic evolvability</p></li>
</ol>

<p><a href="http://www.bizcoder.com/">Darrel Miller</a> has obviously been through some maintenance pain. The web architecture was always designed to not have centralization, and that obviously mean that things are incrementally upgradeable.</p>

<blockquote>
  <p>For me the business case for REST is around client/server coupling and maintenance effort. My experiences with SOAP API&#8217;s on the Microsoft platform were that if you sneezed on the server API that defined the contract you had to recompile and redeploy the clients. And then there is versioning. In the WCF world versioning is a potential nightmare, with changing URLs, XML namespaces on service contracts, message contracts and data contracts.</p>
  
  <p>I believe that REST&#8217;s use of hypermedia and conneg make maintenance, deployment and versioning much easier, which translates to lower costs to the business in the maintenance phase of an application.</p>
</blockquote>

<p><a href="http://bill.burkecentral.com/">Bill Burke</a> responded to Darrel saying how he has been using it.</p>

<blockquote>
  <p>Also, I think interoperability is much easier to achieve with REST because the ubiquity of HTTP. This has a huge positive side-effect for integration as well. My gut tells me that SOA Governance could really reap the benefits of a RESTful architecture as well, but I don&#8217;t have any details yet on how.</p>
  
  <p>All this plus Darrel&#8217;s comment on the fragility of SOAP stacks sold me on the idea of REST which is why I&#8217;ve been really pushing it hard at Red Hat and all our middleware projects.</p>
</blockquote>

<p>A very useful set of responses, thanks to everyone. Will be writing more on this soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.technologyofcontent.com/2009/08/the-resource-oriented-enterprise-followups/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Resource Oriented Enterprise</title>
		<link>http://blog.technologyofcontent.com/2009/08/the-resource-oriented-enterprise/</link>
		<comments>http://blog.technologyofcontent.com/2009/08/the-resource-oriented-enterprise/#comments</comments>
		<pubDate>Sun, 23 Aug 2009 20:40:58 +0000</pubDate>
		<dc:creator>justin</dc:creator>
				<category><![CDATA[REST]]></category>
		<category><![CDATA[architecture]]></category>
		<category><![CDATA[CMS]]></category>
		<category><![CDATA[enterprise]]></category>
		<category><![CDATA[ROA]]></category>
		<category><![CDATA[ROE]]></category>

		<guid isPermaLink="false">http://blog.technologyofcontent.com/?p=49</guid>
		<description><![CDATA[This is the start of getting a bunch of ideas about how web technologies are going to change the way business works and enterprise software is built. I have been meaning to start writing this up for a while. Here is an initial overview, somewhere to start... follow up post soon.]]></description>
			<content:encoded><![CDATA[<p><em>This is the start of getting a bunch of ideas about how web technologies are going to change the way business works and enterprise software is built. I have been meaning to start writing this up for a while. Here is an initial overview, somewhere to start&#8230; Some of these ideas are floating around <a href="http://www.restfulness.info/">elsewhere</a> it seems, from web practitioners working in the enterprise, but there is surprisingly little written up so far.</em></p>

<p>I went to a  meeting a while back with a company starting to move to a web service based, internal API based architecture, and there was a minute where the CTO said (more or less) &#8220;does anyone know of any let or hindrance to this being a SOAP API?&#8221;. Like those moments at weddings, no one spoke out. But I do object. SOAP is not the backbone of a happy architecture, but we do not have the strength to say no right now.</p>

<p>So here is the beginning of the shout out. The enterprise architecture needs to be a resource oriented architecture (ROA) not a service oriented architecture (SOA). The enterprise needs to move from SOAP to REST.</p>

<p>Web developers know this. When given the choice, <a href="http://www.oreillynet.com/pub/wlg/3005">9 out of 20 cats prefer to use REST</a>. It is more productive. It does not involve programs to generate huge chunks of useless code. It involves hypertext (HATEOS) not opaque documents that are mappings of database schemas.</p>

<p>What are the resources in the enterprise? Start with customers. A CRM system is a clear example of something that needs to be modeled as resources. You need API calls that can find products a customer has bought, support tickets, all the core data that you would need to build customer service portals, internal support applications. What is your customer API?</p>

<p>Building this framework can be incremental. You need either tools that already provide REST APIs, which is becoming easier, or a web application development framework. This is the convergence point between application frameworks and web content management. The big issues are the domination of legacy applications with bolt on APIs that may have moved from SQL to CORBA to SOAP over the years. You can however build a REST API over at least parts of these applications to open them up into the enterprise.</p>

<p>OK thats the beginning. Apart from cheaper application development where is the real value?</p>

<p>Resources are the first part of the REST architecture, and resources are much easier to work with than services, as they share uniform semantics, and they are addressable, two keys to making application design simple. The big bit though is the (harder to understand) HATEOS, Hypertext as the Engine of Application State. What this involves is moving the vague and very expensive field of business logic from code (often code that is not even owned or understood by the enterprise, as it has been embodied into code written into systems from suppliers) into hypertext documents.</p>

<p>A concrete example might help here, based on another recent consulting example. A professional body has a set of different membership levels, exams, rules, CPD requirements and so on. These are resources, described states, and hypertext links of state transitions. This is the core of the business logic of the organization, embodied in documents. It can be used to build the membership application, as it describes for example the actions open to a member at the present time, as well as providing potentially a browsable structure, as well as a formal structure that can be used to ask questions about membership (what are the routes to becoming X, for example).</p>

<p>You can view this as a move of business logic to a declarative rather than imperative form. Things do not have to be stored in documents in the underlying storage, although the interface is document and hypertext based. Hypertext makes things human browsable, and declarative makes them computer browsable, and HATEOS makes them discoverable. Business logic becomes content rather than data, rather than there being tables of parameters that the business logic black box feeds off, the states themselves become resources that can be discovered, addressed, and reasoned with.</p>

<p>As states become resources in a REST model, because of the statelessness of web applications, both states and state transitions become first class objects. Constructing ad-hoc queries about state changes should become easy (what percentage of customers renew their contracts, say). The first class objects need to be the ones that are meaningful for the business.</p>

<p><em>There is more to this, it needs expanding. Perhaps we need a manifesto. The software architecture of the web is going to make huge changes to the architecture of other realms, more than most people realize it seems. It is inevitable as things get re-architected around the web that more areas will be affected; also there are the benefits of scalability and reliability that are being created for the web. If anyone has any other business case references for REST please post in comments.</em></p>

<p><a href="http://www.dmst.aueb.gr/dds/etech/arch/rom.png"><img src="http://www.dmst.aueb.gr/dds/etech/arch/rom.png" width="450px"/></a></p>

<p>(Image from <a href="http://www.dmst.aueb.gr/dds/etech/arch/indexw.htm">this software architecture overview</a>).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.technologyofcontent.com/2009/08/the-resource-oriented-enterprise/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced
Content Delivery Network via Amazon Web Services: CloudFront: blog.edge3.org

Served from: blog.technologyofcontent.com @ 2012-02-04 13:53:25 -->
