<?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>Peter Williams</title>
	<atom:link href="http://barelyenough.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://barelyenough.org</link>
	<description></description>
	<lastBuildDate>Wed, 13 Jan 2010 15:29:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Things i never thought i would say</title>
		<link>http://barelyenough.org/blog/2010/01/things-i-never-thought-i-would-say/</link>
		<comments>http://barelyenough.org/blog/2010/01/things-i-never-thought-i-would-say/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 04:05:58 +0000</pubDate>
		<dc:creator>Peter Williams</dc:creator>
				<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://barelyenough.org/?p=429</guid>
		<description><![CDATA[ it only shaved a second off the response time so i reverted it

It is not often that a full one second improvement to the response time of an HTTP request so insignificant that it is not worth committing.
 ]]></description>
			<content:encoded><![CDATA[<blockquote>it only shaved a second off the response time so i reverted it</blockquote>

<p>It is not often that a full one second improvement to the response time of an HTTP request so insignificant that it is not worth committing.</p>
]]></content:encoded>
			<wfw:commentRss>http://barelyenough.org/blog/2010/01/things-i-never-thought-i-would-say/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What are links</title>
		<link>http://barelyenough.org/blog/2010/01/what-are-links/</link>
		<comments>http://barelyenough.org/blog/2010/01/what-are-links/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 05:54:10 +0000</pubDate>
		<dc:creator>Peter Williams</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[hypertext]]></category>
		<category><![CDATA[REST]]></category>

		<guid isPermaLink="false">http://barelyenough.org/?p=422</guid>
		<description><![CDATA[ When designing hypertext formats is it better to provide links for every available action or to provided links to related resources and let the client use the protocol interface to achieve particular actions on those related resources?

I have leaned in both directions at various times. I have never fully convinced myself either.

To make the issues [...] ]]></description>
			<content:encoded><![CDATA[<p>When designing hypertext formats is it better to provide links for every available action or to provided links to related resources and let the client use the protocol interface to achieve particular actions on those related resources?</p>

<p>I have leaned in both directions at various times. I have never fully convinced myself either.</p>

<p>To make the issues a bit clearer let me use and example lifted from the <a href='http://www.subbu.org/blog/2010/01/hypertext-is-the-transaction-engine'>article that got me thinking about this most recently</a>.<sup id='fnref:1'><a href='#fn:1' rel='footnote'>1</a></sup></p>

<pre><code>&lt;cart&gt;
  &lt;!-- some stuff here --&gt;
  &lt;link rel=&quot;http://ex.org/rel/abort&quot; 
        href=&quot;http://ex.org/cart/cancel;token=987654321&quot;/&gt;
  &lt;link rel=&quot;http://ex.org/rel/add-more&quot; 
        href=&quot;http://ex.org/cart/add;token=987654321&quot;/&gt;
  &lt;link rel=&quot;http://ex.org/rel/buy&quot; 
        href=&quot;http://ex.org/cart/buy;token=987654321&quot;/&gt;
&lt;/cart&gt;</code></pre>

<p>I place this example in the &#8220;links for every action&#8221; camp. Each of the links in the example describes exactly one action.</p>

<p>An alternate approach might look something like this.</p>

<pre><code>&lt;cart&gt;
  &lt;!-- some stuff here --&gt;
  &lt;link rel=&quot;http://ex.org/rel/line-items&quot; 
        href=&quot;http://ex.org/cart/line-items;token=987654321&quot;/&gt;
  &lt;link rel=&quot;http://ex.org/rel/new-order&quot; 
        href=&quot;http://ex.org/orders?cart=987654321&quot;/&gt;
&lt;/cart&gt;</code></pre>

<p>From a client perceptive these are a bit different.</p>

<dl>
<dt>Abandoning cart</dt>

<dd>A client that wants to abandon a cart in the first example would make a DELETE or POST &#8211; it&#8217;s a bit hard to tell which from the example &#8211; request to the href of the <code>http://ex.org/rel/abort</code> link. In the second example a similar client would just DELETE the cart resource.</dd>

<dt>Adding item</dt>

<dd>When adding an item in the first example the client would post a www-form-urlencoded document containing the URI of the item to add and the quantity to the href of the <code>http://ex.org/rel/add-more</code> link. In the second example, the same document gets posted to href of the <code>http://ex.org/rel/line-items</code> link.</dd>

<dt>Placing order</dt>

<dd>In the first example the client would make a POST request to the href of the <code>http://ex.org/rel/buy</code> link. In the second example the client would POST a www-form-urlencoded document containing the cart URI and some payment information to the href of the <code>http://ex.org/rel/order</code> link.</dd>
</dl>

<h3 id='differences'>Differences</h3>

<p>Obviously the to approaches result in quite similar markup. The same behavior is encoded in both. In the first example the links are action oriented. All actions that can be taken on an item are explicitly stated using a link. In the second approach the links are data oriented rather than action oriented. Rather than having separate links to retrieve the current line items and to add a new line item the <code>http://ex.org/rel/items</code> link provide both actions using the GET and POST HTTP methods respectively.</p>

<p>The first approach it better at expressing what actions are allowable at any given point in time. For example, once the purchase process has been initiated it does not make sense to abort a cart. So if you GET a cart after POSTing to the <code>http://ex.org/rel/buy</code> link the representation would not have the <code>http://ex.org/rel/abort</code> link.</p>

<p>The second is more concise because it, at least potentially, provides access to more than one action per link based on the standard HTTP methods. You don&#8217;t need to provide a separate abort link because DELETEing the cart is sufficient. You don&#8217;t need to provide separate get line items and add line item links because a single link that can handle GET and POST requests will work.</p>

<p>The first approach is a bit more flexible with regard to implementation details. If you need for some reason to have different URIs for the retrieve line item request than the add line item request you could easily achieve it. The second example makes that impossible.</p>

<h3 id='conclusion'>Conclusion</h3>

<p>I am still not entirely convinced but i am leaning toward the more flexible, verbose and explicit approach of a link for every actions.<sup id='fnref:2'><a href='#fn:2' rel='footnote'>2</a></sup> Having links represent actions rather than resources feels a bit odd, but i think it provides more of the benefits we hope to get from a RESTful architecture.</p>

<div class='footnotes'><hr /><ol><li id='fn:1'>
<p>I am <a href='http://barelyenough.org/blog/2010/01/unobtrusive-link-info/'>still not a fan of the <code>link</code> element</a>. This example is a good one in every other regard.</p>
<a href='#fnref:1' rev='footnote'>&#8617;</a></li><li id='fn:2'>
<p>That counts as at least the third vacillation i have had on this topic. I was leaning the other direction before writing this.</p>
<a href='#fnref:2' rev='footnote'>&#8617;</a></li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://barelyenough.org/blog/2010/01/what-are-links/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Scary stuff</title>
		<link>http://barelyenough.org/blog/2010/01/scary-stuff/</link>
		<comments>http://barelyenough.org/blog/2010/01/scary-stuff/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 17:56:59 +0000</pubDate>
		<dc:creator>Peter Williams</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[education]]></category>

		<guid isPermaLink="false">http://barelyenough.org/?p=420</guid>
		<description><![CDATA[ Apparently, policical and religious ideologies control the Texas text book approval process.

Even if you don&#8217;t live in Texas this matters to you because, as the article explains, Texas has a disproportionate influence on text books in the US.

H/T Martin over at The Atheist Experience
 ]]></description>
			<content:encoded><![CDATA[<p>Apparently, <a href="http://www.washingtonmonthly.com/features/2010/1001.blake.html">policical and religious ideologies control the Texas text book approval process.</a></p>

<p>Even if you don&#8217;t live in Texas this matters to you because, as the article explains, Texas has a disproportionate influence on text books in the US.</p>

<p>H/T <a href="http://atheistexperience.blogspot.com/2010/01/ill-educated-fools-in-charge-of.html">Martin over at The Atheist Experience</a></p>
]]></content:encoded>
			<wfw:commentRss>http://barelyenough.org/blog/2010/01/scary-stuff/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unobtrusive link info</title>
		<link>http://barelyenough.org/blog/2010/01/unobtrusive-link-info/</link>
		<comments>http://barelyenough.org/blog/2010/01/unobtrusive-link-info/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 05:19:14 +0000</pubDate>
		<dc:creator>Peter Williams</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://barelyenough.org/?p=416</guid>
		<description><![CDATA[ Mr Amundsen&#8217;s recent post regarding the design of &#8220;semantic machine media types&#8221; got me thinking about media type design. One of the commonly encouraged practices, particularly on the REST discuss group, is the use of link elements.

I really dislike this idea. It sets my teeth on edge because it treats links &#8211; which are possibly [...] ]]></description>
			<content:encoded><![CDATA[<p><a href='http://amundsen.com/blog/archives/1023'>Mr Amundsen&#8217;s</a> recent post regarding the design of &#8220;semantic machine media types&#8221; got me thinking about media type design. One of the commonly encouraged practices, particularly on the <a href='http://tech.groups.yahoo.com/group/rest-discuss'>REST discuss group</a>, is the use of <a href='http://tools.ietf.org/html/rfc4287#section-4.2.7'><code>link</code> elements</a>.</p>

<p>I really dislike this idea. It sets my teeth on edge because it treats links &#8211; which are possibly the most important bits of data in existence &#8211; as second class citizens. It is easiest to show what i mean with a bit of extrapolation:</p>

<pre><code>&lt;complexElement rel=&quot;entry&quot;&gt;
  &lt;string rel=&quot;id&quot;&gt;234132&lt;/string&gt;
  &lt;string rel=&quot;displayName&quot;&gt;Peter Williams&lt;/string&gt;
  &lt;complexElement rel=&quot;name&quot;&gt;
    &lt;string rel=&quot;familyName&quot;&gt;Williams&lt;/string&gt;
    &lt;string rel=&quot;givenName&quot;&gt;Peter&lt;/string&gt;
  &lt;/complexElement&gt;
  &lt;complexElement rel=&quot;emails&quot;&gt;
    &lt;link rel=&quot;email&quot; href=&quot;mailto:pezra@barleyenough.org&quot;/&gt;
    &lt;string rel=&quot;type&quot;&gt;personal&lt;/string&gt;
  &lt;/complexElement&gt;
&lt;/complexElement&gt;</code></pre>

<p>That is what a <a href='http://portablecontacts.net/'>portable contact</a> might look like if we treated all data the way <code>link</code> elements work. That example looks pretty ugly to me, as i suspect it does to most people. It is ugly because very important information regarding the role of elements is relegated to a subsidiarity position in favor of fairly unimportant information about its type. However, <code>link</code> elements do to links exactly what my example does to all the data. The effect is that properties whose values happen to be independently addressable resources are obfuscated.</p>

<p>The <a href='http://en.wikipedia.org/wiki/Revealed_preference'>revealed preference</a> of the world is against <code>link</code> elements. Just look at pretty much any format that embeds application specific semantics. As far as i know, there is not a single widely used format that actually represents its links as <code>link</code> elements. Even <a href='http://tools.ietf.org/html/rfc4287'>atom</a> uses properly named elements for most its links. The <code>link</code> element it defines is largely relegated to the back water of extensibility.</p>

<p>One benefit that <code>link</code> elements have, or at least could have if they where more widely used, is the facilitation of standard link processing tools. Fortunately, we do not have to give up the expressiveness and clarity of <a href='http://c2.com/cgi/wiki?IntentionRevealingNames'>intention revealing names</a> to achieve this result. Rather than obscuring the links we could just treat them as normal data. The additional information needed to support standard tools could be added in a relatively unobtrusive way. Consider the following:</p>

<pre><code>&lt;entry xmlns:link=&quot;http://unobtrusive-generic-linking.org/&quot;&gt;
  ...
  &lt;emails&gt;
    &lt;value link:hrefDisposition=&quot;elementContent&quot; 
           link:rel=&quot;foo&quot;&gt;
      mailto:pezra@barelyenough.org&lt;/value&gt;
    &lt;type&gt;personal&lt;/type&gt;
  &lt;emails&gt;
&lt;/entry&gt;</code></pre>

<p>This is idea is similar to <a href='http://www.w3.org/TR/xlink'>xLink</a> but more flexible and simpler to use.</p>

<p>You could expand the idea to JSON with relative ease. Consider the following expansion of the portable contacts json format tagged with some unobtrusive link info.</p>

<pre><code>{&quot;entry&quot;: [
  {&quot;id&quot;: &quot;42&quot;,
  &quot;emails&quot;:
    [{&quot;address&quot;   : &quot;mailto:pezra@barelyenough.org&quot;,
      &quot;type&quot;      : &quot;personal&quot;,
      &quot;_linkInfo&quot; : {&quot;hrefDisposition&quot; : &quot;address&quot;, 
                     &quot;rel&quot; : &quot;foo&quot;}}]}]}</code></pre>

<p>Unobtrusive link info makes links visible to and usable by generic link processing tools while protecting the use of intention revealing names that format designers, and users, want. This is important because it allows new formats to reuse &#8220;standard&#8221; link semantics more easily and uniformly.</p>
]]></content:encoded>
			<wfw:commentRss>http://barelyenough.org/blog/2010/01/unobtrusive-link-info/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Novelty value</title>
		<link>http://barelyenough.org/blog/2009/12/novelty-value/</link>
		<comments>http://barelyenough.org/blog/2009/12/novelty-value/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 20:22:29 +0000</pubDate>
		<dc:creator>Peter Williams</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Audrey]]></category>

		<guid isPermaLink="false">http://barelyenough.org/?p=401</guid>
		<description><![CDATA[ 

Eating and watching television at the same time is seldom done at my house.  It must be fun, though, because Audrey lets her stuffed animals do it.
 ]]></description>
			<content:encoded><![CDATA[<p><a href="http://barelyenough.org/blog/2009/12/novelty-value/img_0040/" rel="attachment wp-att-400"><img src="http://barelyenough.org/wordpress/wp-content/uploads/2009/12/IMG_0040-e1262204209609-600x590.jpg" alt="Babys eating in front of the TV" title="Babys eating in front of the TV" width="600" height="590" class="alignnone size-large wp-image-400" /></a></p>

<p>Eating and watching television at the same time is seldom done at my house.  It must be fun, though, because Audrey lets her stuffed animals do it.</p>
]]></content:encoded>
			<wfw:commentRss>http://barelyenough.org/blog/2009/12/novelty-value/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>In defense of link storage</title>
		<link>http://barelyenough.org/blog/2009/11/in-defense-of-link-storage/</link>
		<comments>http://barelyenough.org/blog/2009/11/in-defense-of-link-storage/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 04:46:00 +0000</pubDate>
		<dc:creator>Peter Williams</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[REST]]></category>

		<guid isPermaLink="false">http://barelyenough.org/?p=399</guid>
		<description><![CDATA[ It seems that more and more are beginning to grasp the hypermedia constraint of REST. This is an unmitigated Good Thing. However, once you get hypermedia the idea of a client persisting links that it has found starts to seem a little odd. For example, Kirk Wylie describes clients that store links as &#8220;not well [...] ]]></description>
			<content:encoded><![CDATA[<p>It seems that more and more are beginning to grasp the <a href='http://www.infoq.com/articles/mark-baker-hypermedia'>hypermedia constraint</a> of REST. This is an unmitigated Good Thing. However, once you get hypermedia the idea of a client persisting links that it has found starts to seem a little odd. For example, Kirk Wylie describes clients that store links as &#8220;not well behaved&#8221; in his <a href='http://www.infoq.com/presentations/restful-financial-systems-integration'>excellent presentation on REST in financial systems</a>. Even on the rest-discuss mailing list there is <a href='http://tech.groups.yahoo.com/group/rest-discuss/message/13516'>no consensus on the matter</a>.</p>

<p>The idea of an application as a set of states (read: representations) with transitions (read: links) to other states seems to go against the idea of storing links. Transitions from one application state to another are surely transient. Any change in the application state, either by this client or some completely unrelated client, could easily invalidate those transitions. In that context a client that stored links for later use would surely be doomed dereferencing dead links for the rest of it&#8217;s days.</p>

<p>Further, the idea that clients might store links is a frightening specter for maintainers of services. If clients store links, and you prefer not to break those clients, you must continue supporting any links you have ever included in any representation in perpetuity. Talk about limiting your design freedom. Such a strict requirement would surely raise the cost of maintaining the service over time.</p>

<h2 id='reality_sets_in'>Reality sets in</h2>

<p>Those are scary thoughts. Some of these issues are even real. But end the end it doesn&#8217;t matter. Almost all non-trivial systems are going to require that URIs be stored in places other than the origin server. Sometimes these stored URIs will merely be caches. Other times they will be data that cannot be recalculated mechanically.</p>

<p>For example, say you have an order taking system and an inventory system. When placing an order the user goes to the web site, searches for &#8220;coffee&#8221;, selects the third item in the results and places an order 1 of that item. An order is a set of line items each of which references a product. Once payment is received the order system is going to need to be able to tell the shipping department which items from inventory to send to the customer.</p>

<p>The inventory system has, of course, a URI for every type of product that is for sale. So the simplest and most effective way for an order to reference a product is to use that the inventory URI for that product. URIs are called universal resource <em>identifiers</em> for a reason, we might as well use them as such.</p>

<p>In this example, we have a situation where the product references in the order are not merely caches of URIs. Many things may change the ordering of search results &#8211; a new product being added, an old one being discontinued, even a small change to a description of some product. So at any moment the the third item in the search results for &#8220;coffee&#8221; might be different. Once the user has made their selection no automata can reliably retrace those steps.</p>

<p>The implications of this are significant. The inventory must continue to support the product URIs used in orders until such time as the order system would never care to dereference those URIs again. If a month from now the user comes back and wants to see their order history, those product URIs had better still work.</p>

<p>Fortunately, HTTP provides us with a ready solution. Behold the awesomeness that is <a href='http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.2'>HTTP redirection</a>. HTTP redirection is your best friend when it comes to gracefully changing REST/HTTP applications. Clients get what they need &#8211; URIs continue to work as identifiers indefinitely &#8211; and servers get what they need &#8211; a lot of freedom to change the names and dispositions of resources.</p>

<h2 id='transient_links'>Transient links</h2>

<p>We are still faced with this issue of the transient nature of links. Certainly, many links encode transitions which may be transient. The client has no general way of distinguishing between links which represent transiently available state transitions, and those that represent more permanent transitions.</p>

<p>In our example, immediately after creating an order, it probably provides some links to pay for the order. After the user has provided payment those transition would no longer be valid. However, the link to the inventory product is a more permanent part of the order resource.</p>

<p>The only tractable way i see to deal with this issue is to document the lifespan the various link found in a representation. Once the client implementer understand the semantics of the links they well often be able to infer the likely lifespan of the links without further input. However, guidance can be provided in situations where precision is required or the lifespan is ambiguous. A transient link is, by definition, an option part of the representation so documenting the conditions that cause it to be present is likely to be required anyway.</p>

<h2 id='best_practices_server'>Best practices: Server</h2>

<p>REST/HTTP application developers should assume that clients will store links and dereference them after indeterminate periods of time. When resources are relocated or renamed requests to the resource&#8217;s obsolete URI should be redirected to the canonical URI using a <code>301 Moved
Permanently</code> response.</p>

<p>For links whose validity has a bounded lifespan the documentation of the representations (the media type) should explicitly layout that the link is transient and optional. If possible the documentation should also describe the conditions of the links existence.</p>

<p>Remind client developers early and often that client <em>must</em> follow any and all redirects from the server.</p>

<h2 id='best_practices_client'>Best practices: Client</h2>

<p>Clients should follow redirects. Fastidiously.</p>

<p>Clients should update it&#8217;s internal storage upon receiving a <code>301
Moved Permanently</code> response by replace the URI it requested with newly provided location.</p>

<p>Client developers should be aware of transient links in the representations being dealt with. Either do not store these URIs or ensure that attempts so use these URIs handle failure in ways that make sense for the application.</p>

<p>Believe and follow the redirections the server sends to you. Seriously.</p>
]]></content:encoded>
			<wfw:commentRss>http://barelyenough.org/blog/2009/11/in-defense-of-link-storage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Elliot&#8217;s 6th Birthday</title>
		<link>http://barelyenough.org/blog/2009/09/elliot-6th-bday/</link>
		<comments>http://barelyenough.org/blog/2009/09/elliot-6th-bday/#comments</comments>
		<pubDate>Wed, 23 Sep 2009 03:41:54 +0000</pubDate>
		<dc:creator>Peter Williams</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[birthday]]></category>
		<category><![CDATA[Elliot]]></category>

		<guid isPermaLink="false">http://barelyenough.org/?p=398</guid>
		<description><![CDATA[ Elliot is six today!



It has been a big year. Probably the biggest thing is kindergarten which he loves. He is getting to be a big kid but he definitely still has his little kid moments.
 ]]></description>
			<content:encoded><![CDATA[<p>Elliot is six today!</p>

<p><img src='http://barelyenough.org/blog/uploads/elliot-6th-bday-donut-and-candles.jpg' alt='Elliot blowing out candles' /></p>

<p>It has been a big year. Probably the biggest thing is kindergarten which he <em>loves</em>. He is getting to be a big kid but he definitely still has his little kid moments.</p>
]]></content:encoded>
			<wfw:commentRss>http://barelyenough.org/blog/2009/09/elliot-6th-bday/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Small pieces</title>
		<link>http://barelyenough.org/blog/2009/09/small-pieces/</link>
		<comments>http://barelyenough.org/blog/2009/09/small-pieces/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 13:47:52 +0000</pubDate>
		<dc:creator>Peter Williams</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[REST]]></category>

		<guid isPermaLink="false">http://barelyenough.org/?p=397</guid>
		<description><![CDATA[ The idea of creating a functioning application by loosely connecting many small pieces has been around for a long time. Certainly since early in the development of Unix, and probably even before. It has survived because it is such a powerful approach.

This idea is at the very core of the architecture of the web. However, [...] ]]></description>
			<content:encoded><![CDATA[<p>The idea of creating a functioning application by loosely connecting many small pieces has been around for a long time. Certainly since early in the development of Unix, and probably even before. It has survived because it is such a powerful approach.</p>

<p>This idea is at the very core of the architecture of the <a href='http://smallpieces.com'>web</a>. However, achieving such compartmentalization has been difficult for business application development. The recent advancement of REST into the mainstream is bringing this mentality within the reach of many development teams.</p>

<p>The small pieces approach totally dominates the lower levels of software development in the form of object oriented programing. Each &#8220;object&#8221; is a small self-contained piece, and a large number of the small pieces are joined together to provide the functionality of the application.</p>

<p>At the application level, however, this approach does not enjoy the same ubiquity. It is much more common to see a monolithic approach. There is one giant application that does everything for everyone. The path of least resistance for any single new feature is to implement it in the existing application structure. There is some overhead in creating a new application, so in the short term multiple small applications seems more costly.</p>

<p>Unfortunately, while it is easier to add any particular feature to an existing application doing so means you give up all the advantages of small pieces loosely joined. And, the advantages of a small application approach are significant.</p>

<p>Perhaps the single largest advantage is that smaller applications are easier to understand. To effectively improve or maintain software it is necessary to understand it. The <a href='http://onestepback.org/articles/connascence'>connascence</a> of one bit of code and everything else is often unclear. This lack of clarity means that the risk of any particular change having unintentional impacts increases with the size of the code base. Building more smaller applications is an effective way to manage such risks.</p>

<p>Another advantage of this approach is that it makes using novel implementation techniques more workable. If you have a large monolithic application and you get a new requirement that might benefit from a different language, framework or runtime you are pretty much out of luck. In a compartmentalized architecture each application can have it&#8217;s own technology stack. If you new a set of features that that might benefit from the concurrency of Erlang you can use for that component without impacting the other components in any way.</p>

<p>Have several small applications often turns intractably large efforts in to several smaller tasks. For example, consider upgrading the framework on which your application(s) are built to a new version. The new version has features and improvements that would be highly beneficial but target version is incompatible with the version you are currently running in some minor ways.</p>

<p>Such an upgrade will necessarily touch most of the application. Its risk profile will be very broad. The benefits of the upgrade will rarely be directly visible to the business so the priority of such work is always rather low. The cost and risk of such work is often so large, and the perceived benefit so small, that such work is put off until support is being terminated for the version currently in use.</p>

<p>In a compartmentalized system the any single component can be upgraded much more quickly, and at lower risk. The benefits of upgrading match the effort required much more closely in such situation. Many times the effort required is often so low there is no discussion required, upgrades become normal refactoring tasks.</p>

<p>Experimentation is also quite a bit more manageable in a compartmentalized architecture. The smaller size of the components makes implementing new ideas faster and more approachable. This lowers the cost of implementing new ideas and recovering if the idea does not pan out.</p>

<p>When experimenting it is often not immediately clear if a new idea really is an improvement. Sometimes developers and users need to work with it a for a while to form a reasoned opinion. In compartmentalized systems experiments can be designed to impact a small portion of the total application. This allows small experiments to can soak for a while until the team is ready to call the results. If idea worked the practice can be expanded to the rest of the components, if not it is only a small portion of the code base that needs to be cleaned up.</p>

<p>It is worth noting that this approach will effectively true your large application into a distributed system of small applications. This is distributed applications are a little scary, and for good reason. Before you embark on this path you should have a plan for how to integrate the parts into a whole. For most business application <a href='http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm'>REST</a>/HTTP is a very good technology for integrating applications.</p>

<p>There are many other situations where the small pieces approach&#8217;s conversion of large tasks into small ones is an advantage. There are also situations where it causes more overall work. In my experience, though, the chunking of tasks is well worth the small additional overhead. It is much easier to manage many small semi-independent development efforts than a few large ones.</p>
]]></content:encoded>
			<wfw:commentRss>http://barelyenough.org/blog/2009/09/small-pieces/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Audrey&#8217;s 4th Birthday</title>
		<link>http://barelyenough.org/blog/2009/08/audreys-4th-birthday/</link>
		<comments>http://barelyenough.org/blog/2009/08/audreys-4th-birthday/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 04:35:36 +0000</pubDate>
		<dc:creator>Peter Williams</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Audrey]]></category>

		<guid isPermaLink="false">http://barelyenough.org/?p=396</guid>
		<description><![CDATA[ Audrey is 4 today. It has been great year. She has grown so much since her last birthday. (But she still likes chocolate cake.)


 ]]></description>
			<content:encoded><![CDATA[<p>Audrey is 4 today. It has been great year. She has grown so much since <a href='http://barelyenough.org/blog/2008/08/audrey-is-3/'>her last birthday</a>. (But she still likes chocolate cake.)</p>

<p><img src='http://barelyenough.org/blog/uploads/dsc_3574.jpg' alt='Audrey and birthday cake' /></p>
]]></content:encoded>
			<wfw:commentRss>http://barelyenough.org/blog/2009/08/audreys-4th-birthday/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kindergarten</title>
		<link>http://barelyenough.org/blog/2009/08/kindergarten/</link>
		<comments>http://barelyenough.org/blog/2009/08/kindergarten/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 20:25:53 +0000</pubDate>
		<dc:creator>Peter Williams</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Elliot]]></category>
		<category><![CDATA[School]]></category>

		<guid isPermaLink="false">http://barelyenough.org/?p=394</guid>
		<description><![CDATA[ Elliot started kindergarten last week. So far things are going pretty well. He likes learning new things and he seems smitten with his teacher. One day last week was &#8220;his favorite day of kindergarten&#8221; because they &#8220;did math&#8221;. I am pretty sure Elliot, and the other kids, are going to have a good year.



The parents [...] ]]></description>
			<content:encoded><![CDATA[<p>Elliot started kindergarten last week. So far things are going pretty well. He likes learning new things and he seems smitten with his teacher. One day last week was &#8220;his favorite day of kindergarten&#8221; because they &#8220;did math&#8221;. I am pretty sure Elliot, and the other kids, are going to have a good year.</p>

<p><img alt='Elliot on his first day of kindergarten' src='http://barelyenough.org:www/wordpress/wp-content/uploads/kindergarten-photo.jpg' /></p>

<p>The parents of kindergartners, on the other hand, are already having a bit of trouble communicating effectively. I fear for what this might mean over the course of the year. As a parent you, of course, want do what you can to enhance the education of the children. You have to do it with a group of people who you have never even meet before the first day of school. Worse yet those people are only loosely committed to the project. Personal issues, personality conflicts or simple disinterest in the task at hand can easily remove many individuals from the effective team at any moment.</p>

<p>It will be interesting to see how the parents self organize over the year. Fortunately, the parents are just support for the teacher. Even if we fail to form a cohesive team i think the teacher will still manage to educate the kids. That is what professionals do.</p>

<p>Speaking of the profession of teaching, the politics teachers have to manage is rather impressive. Even for a class of 25 kindergartners it must be daunting&#8230; you have to maintain the interest and respect of 25 kids; keep about 50 parents placated and helping as much as possible; all while keep the principle happy. And to make that more complicated really none of those people get to choose if they really want work with any of the others. And all that before you even get to the job at hand.</p>
]]></content:encoded>
			<wfw:commentRss>http://barelyenough.org/blog/2009/08/kindergarten/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
