<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<?xml-stylesheet href="http://duncan-cragg.org/css/atom.css" type="text/css" ?>
<!-- Copyright (c) 2006 Duncan Cragg -->

<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
    <id>http://duncan-cragg.org/blog/</id>
    <title>What Not How - Posts tagged 'microformats'</title>
    <subtitle>Duncan Cragg on Declarative Architectures</subtitle>
    <author><name>Duncan Cragg</name></author>
    <logo>/favicon.gif</logo>
    <icon>/favicon.ico</icon>
    <rights>All content including photos and images by Duncan Cragg. Copyright (c) Duncan Cragg, your rights preserved: see /CXL.html</rights>
    <generator uri="http://www.djangoproject.com">A Django Production.</generator>
    <link rel="alternate" type="text/html" href="http://duncan-cragg.org/blog/" title="What Not How" />
    <link rel="self" type="application/atom+xml" href="http://duncan-cragg.org/blog/atom/microformats/" />

    <updated>2009-11-25T21:29:00Z</updated>


    <entry>
        <id>http://duncan-cragg.org/blog/post/deriving-forest/</id>
        <title>Deriving FOREST</title>
        <published>2009-11-25T21:29:00Z</published>
        
        <updated>2009-11-25T21:29:00Z</updated>
        
        <link rel="alternate" type="text/html" href="http://duncan-cragg.org/blog/post/deriving-forest/" title="Deriving FOREST" />
        
        <category term="architecture" />
        
        <category term="app" />
        
        <category term="microformats" />
        
        <category term="rest" />
        
        <category term="atom" />
        
        <category term="forest" />
        
        <summary type="xhtml">
            <div xmlns="http://www.w3.org/1999/xhtml">

<p>

Say we want to integrate multiple applications which handle order processing. OK, that&#39;s
got to be one of the dullest starts to a blog post. Never mind, bear with me...
</p><p>
So, we have applications on separate servers for handling and driving data such as
orders, product descriptions and catalogues, stock lists, price lists, tracking, packing
notes and delivery notes, invoices, payments, etc.
</p><p>
We may choose an SOA approach, of course. But let&#39;s say our sponsors have heard of this
cheaper alternative: REST! Which to them means &#39;using Web technology to save money&#39;.
</p><p>
Now .. suppose we push the time slider right back to before Mark Baker and the SOA -vs-
REST Wars - or the &#39;SOAP -vs- REST Wars&#39; as people naively called it. To when REST was
simply (!) a description of the Web&#39;s architectural style...
</p><p>
What if we revisit the applicability of the Web, and its abstraction into REST, to the
architecture of machine-to-machine distributed systems - to something like our order
processing integration?
</p><p>
I think we&#39;d quickly arrive at something that looks more like
<a href="http://duncan-cragg.org/blog/post/forest-get-only-rest-integration-pattern/">FOREST</a>
than, say, AtomPub...
 &#160; ...
</p>

            </div>
        </summary>
        <content type="xhtml" xml:space="preserve">
            <div xmlns="http://www.w3.org/1999/xhtml">

<p>
</p><div class="summary"><p>
Say we want to integrate multiple applications which handle order processing. OK, that&#39;s
got to be one of the dullest starts to a blog post. Never mind, bear with me...
</p><p>
So, we have applications on separate servers for handling and driving data such as
orders, product descriptions and catalogues, stock lists, price lists, tracking, packing
notes and delivery notes, invoices, payments, etc.
</p><p>
We may choose an SOA approach, of course. But let&#39;s say our sponsors have heard of this
cheaper alternative: REST! Which to them means &#39;using Web technology to save money&#39;.
</p><p>
Now .. suppose we push the time slider right back to before Mark Baker and the SOA -vs-
REST Wars - or the &#39;SOAP -vs- REST Wars&#39; as people naively called it. To when REST was
simply (!) a description of the Web&#39;s architectural style...
</p><p>
What if we revisit the applicability of the Web, and its abstraction into REST, to the
architecture of machine-to-machine distributed systems - to something like our order
processing integration?
</p><p>
I think we&#39;d quickly arrive at something that looks more like
<a href="http://duncan-cragg.org/blog/post/forest-get-only-rest-integration-pattern/">FOREST</a>
than, say, AtomPub...
</p></div><p>
Some pretty obvious things to notice about the Web and, indeed, REST:
</p><ul>
<li>The Web is essentially data on URLs of standard content types containing more URLs;</li>
<li>The Web is the Web because of the massive proliferation of links in that data;</li>
<li>REST mostly concerns itself with the consequences of GET, including cacheing;</li>
<li>The Web uses, I don&#39;t know, let&#39;s say 98% GET, 2% POST, around 0% other methods.</li>
</ul><p>
In other words, the Web, and its good qualities, are mostly based on:
</p><pre>
GET URL -&gt; HTML -&gt; a.href=URL -&gt; GET URL ..
</pre><p>
</p><p>
When applying this Web/REST architectural style to our integration scenario, there are
things that we can say right now with certainty will be different, but will have
corresponding elements:
</p><ul>
<li>It&#39;s about data not documents, so HTML is probably going to be replaced by XML, although perhaps XHTML+Microformats or Atom would make a good compromise;</li>
<li>We have a choice of link specs: xhtml:a.href, atom:link.rel, xml:xlink; I don&#39;t think we&#39;ll be using XLink since no-one else seems to;</li>
<li>We&#39;ll probably use machine-generated URLs perhaps containing UUIDs, GUIDs or whatever.</li>
</ul><p>
In other words, we&#39;re not going to be spinning a hypermedia Web - it&#39;s more a
&#39;hyperdata&#39; Web.
</p><p>
So, in order to emulate the document Web in our hyperdata integration Web, we&#39;ll mostly
be doing something like:
</p><pre>
GET ID-URL -&gt; XHTML -&gt; a.href=ID-URL -&gt; GET ID-URL ..
</pre><p>
</p><p>&#160;</p><p>
Oh! I&#39;ve got some 
<a href="http://docs.google.com/present/view?id=0AUwWWDrZPVcFZGZtODR6YzZfMGhiM3MyMmR0&amp;hl=en">slides</a>
of all this on Google Docs: we&#39;re up to Slide 2! Maybe right-click, open in a new window...
</p><p>&#160;</p><p>
<b>Symmetry - Slide 3</b>
</p><p>
But by far the biggest difference between the Web and an integration scenario is that
the asymmetry on the network goes away; even for a cross-enterprise integration.
</p><p>
Where the Web&#39;s browser clients and site servers have always been asymmetric - clients
being hidden away and only able to establish outbound connections - machine-to-machine
integration is fundamentally symmetric - all servers can be made visible to each other.
</p><p>
Now, in order to keep the well-studied benefits described in REST, including separation
of concerns, we should aim to maintain the client-server, layered structure in the use
of the protocol.
</p><p>
But <i>clients can be servers and vice-versa</i>!
</p><p>
So, in machine-to-machine integration scenarios, we have:
</p><ul>
<li>Two-way GETs on machine-minted URLs pointing at XHTML+Microformats or Atom content containing more links.</li>
</ul><p>
In other words:
</p><ul>
<li>A hyperdata Web both created and consumed by the applications being integrated.</li>
</ul><p>
All of the dynamic data or hyperdata items in our order processing scenario will be
distributed across the many applications being integrated. Each application serves
its part of the hyperdata Web to the others. 
</p><p>
And, of course, the hyperdata joins all these applications up: a payment resource
in the accounting application will point to an order resource in the order processing
application, etc.
</p><p>&#160;</p><p>
<b>Interactions and Application State</b>
</p><p>
Now, each application has its own set of business rules and constraints over the
hyperdata parts that it governs. 
</p><p>
So how exactly should the applications publishing those bits of the hyperdata Web
interact? How do orders interact with packing notes and stock levels, with payments and
accounts?
</p><p>
In the Web, you go to a site and jump some links. Each page brings in CSS, Javascript,
images, maybe iframes: an eager assembly of pages from links to many resources, in
contrast to the lazy, on-demand fetching of links from a user jumping them.
</p><p>
The browser at any time has a state that depends on the page and images, etc, currently
being viewed, plus the history of previous pages, bookmarks, etc.
</p><p>
Search engines in the Web, without a user driving things, are eager to traverse links
in order to do their work indexing pages. Order processing applications will probably
have more in common with search engines than with browsers.
</p><p>
REST describes this in terms of hypermedia - links - driving &#39;application state&#39;. 
</p><p>
So we next need to decide what &#39;application state&#39; is, in our Web- and REST-driven
architecture for machine-to-machine distributed systems; where the user driving
hypermedia link traversals is replaced by business rules or logic driving hyperdata link
traversals.
</p><p>
Each integrated application has its own &#39;application state&#39;, so, to follow REST, this
application state should be driven by the surrounding hyperdata of peer applications,
according to those business rules.
</p><p>&#160;</p><p>
<b>Application State is Linked Resources - Slide 4</b>
</p><p>
In fact - and this is a consequence of the symmetry of integration - <i>&#39;application
state&#39; is those very resources that the application contributes to the hyperdata Web!</i>
</p><p>
A stock tracking application&#39;s state is pretty well described by a bunch of resources
describing the stock levels. A fulfilment application&#39;s state could be inferred by
inspecting the outstanding packing notes.
</p><p>
We&#39;re not limited to the asymmetric browser-server of the Web, where the browser&#39;s
&#39;application state&#39; is never visible except when it POSTs something back.
</p><p>
It&#39;s more like a search engine, where you can publically access an &#39;application state&#39;
that is entirely driven by the hypermedia crawled by the search bot.  A search engine&#39;s
application state is rendered into the results page resources you see when you do a search.
</p><p>
So the resources of each application in the order processing integration are driven by the
surrounding, linked resources of the other applications.
</p><p>
You could rephrase REST&#39;s &#39;hypermedia as the engine of application state&#39; when applying
it to symmetric machine-to-machine integration in this neat way:
</p><blockquote class="others-content"><div><p>
Hyperdata as the Engine of Hyperdata.
</p></div></blockquote><p>
</p><p>&#160;</p><p>
<b>The Functional Observer Programming Model - Slide 5</b>
</p><p>
So now, how do we program the hyperdata-driven-hyperdata of our integrated applications?
</p><p>
How do we animate the stock tracking hyperdata chunk over here in the face of today&#39;s
packing notes in their hyperdata chunk over there?
</p><p>
That&#39;s what 
<a href="http://duncan-cragg.org/blog/post/forest-get-only-rest-integration-pattern/">FOREST</a>
is all about!  
</p><p>
The name &#39;FOREST&#39; stands for 
&#39;<a href="http://duncan-cragg.org/blog/post/forest-functional-observer-rest/">Functional Observer REST</a>&#39;.
</p><p>
The words &#39;Functional Observer&#39; describe FOREST&#39;s hyperdata-driven-hyperdata programming
model. But it&#39;s much simpler than it sounds...
</p><p>
<i>A FOREST resource in the hyperdata Web sets its next state as a Function of its
current state plus the state of those other resources Observed by it via its links.</i>
</p><p>
The best way to encode such state evolution is in rewrite rules or functions which match
a resource and its linked resources on the left-hand side, then rewrite that resource&#39;s
state on the right-hand side.
</p><p>&#160;</p><p>
<b>Not Like AtomPub, then</b>
</p><p>
So, quite a different conclusion from what is now the &#39;conventional REST&#39; of the four
verbs - GET, POST, PUT and DELETE.
</p><p>
Quite different from asymmetric, one-way application protocols as modelled by AtomPub,
in which clients aren&#39;t considered worthy to hold their own resources, but are allowed
only an inscrutable &#39;application state&#39;.
</p><p>
By focusing on GET and the freedom in integration to be symmetric, we&#39;ve arrived at a
general distributed programming model, FOREST, that allows us to express business rules
that drive an application&#39;s hyperdata in the context of another application&#39;s hyperdata.
</p><p>
Watch this blog (and <a href="http://twitter.com/duncancragg">Twitter</a>), where I&#39;ll be talking
more about the benefits of FOREST, its implementation, and, above all, offering examples of how it would work (once the code is ready enough!).
</p><p>

</p>

            </div>
        </content>
    </entry>
    
    <entry>
        <id>http://duncan-cragg.org/blog/post/web-objects-ask-they-never-tell-rest-dialogues/</id>
        <title>Web Objects Ask, They Never Tell | The REST Dialogues</title>
        <published>2009-08-13T11:43:00Z</published>
        
        <updated>2009-08-13T11:43:00Z</updated>
        
        <link rel="alternate" type="text/html" href="http://duncan-cragg.org/blog/post/web-objects-ask-they-never-tell-rest-dialogues/" title="Web Objects Ask, They Never Tell | The REST Dialogues" />
        
        <category term="semanticweb" />
        
        <category term="architecture" />
        
        <category term="declarative" />
        
        <category term="publishsubscribe" />
        
        <category term="p2p" />
        
        <category term="app" />
        
        <category term="microformats" />
        
        <category term="dialogue" />
        
        <category term="event-driven" />
        
        <category term="rest" />
        
        <category term="scalability" />
        
        <category term="rest-observer" />
        
        <summary type="xhtml">
            <div xmlns="http://www.w3.org/1999/xhtml">

<p>

In an exclusive nine-part dialogue with <i>an imaginary eBay
Architect</i>, we present an accessible discussion of the 
REST vs. SOA issue.
</p><p>
Although eBay have what they call a &#39;REST&#39; interface, it is, in
fact, a 
<a href="http://duncan-cragg.org/blog/post/strest-service-trampled-rest-will-break-web-20/">STREST</a>
interface, and only works for a few of the many function calls
that they make available via SOAP.
</p><p>
In this <a href="http://duncan-cragg.org/blog/post/getting-data-rest-dialogues/">dialogue series</a>,
I argue the case for eBay to adopt a truly REST approach to
their integration API. 
</p><p>
<b>Part 9: Web Objects Ask, They Never Tell</b>
 &#160; ...
</p>

            </div>
        </summary>
        <content type="xhtml" xml:space="preserve">
            <div xmlns="http://www.w3.org/1999/xhtml">

<p>
</p><div class="summary"><p>
In an exclusive nine-part dialogue with <i>an imaginary eBay
Architect</i>, we present an accessible discussion of the 
REST vs. SOA issue.
</p><p>
Although eBay have what they call a &#39;REST&#39; interface, it is, in
fact, a 
<a href="http://duncan-cragg.org/blog/post/strest-service-trampled-rest-will-break-web-20/">STREST</a>
interface, and only works for a few of the many function calls
that they make available via SOAP.
</p><p>
In this <a href="http://duncan-cragg.org/blog/post/getting-data-rest-dialogues/">dialogue series</a>,
I argue the case for eBay to adopt a truly REST approach to
their integration API. 
</p><p>
<b>Part 9: Web Objects Ask, They Never Tell</b>
</p></div><p>
</p><p>
<b>eBay Architect:</b> You&#39;ve pushed a lot of responsibility up to the business logic and
away from the distribution technologies - away from the HTTP level.
</p><p>
As I understand it, you only want to use HTTP to implement a distributed Observer
Pattern, where clients can become servers?
</p><p>
<b>Duncan Cragg:</b> Indeed. REST can be symmetric when used in integration outside of the
Web. Further, these server-clients can have resources that do their <i>own</i> GET-ing,
with POST <i>callbacks</i>, in order to Observe other resources. I&#39;ve given many examples
of this style.
</p><p>
<b>eA:</b> So how do you program such a distributed system at the business logic level?
</p><p>
<b>DC:</b> Well you need to be able to easily express that the state of a resource depends
on the latest state - the intentions and declarations - of other resources it is Observing.
</p><p>
My vision is that you would express this business logic in a simple, powerful and
expressive declarative language.
</p><p>
<b>eA:</b> Hmmm.. Just try getting all declarative on someone who just wants his share prices
on time!  No-one in business understands such abstract concepts.
</p><p>
<b>DC:</b> Oh no? The favourite programming tool of business is the spreadsheet! 
</p><p>
And HTML is a form of declarative programming: imagine if you had to 
<a href="http://duncan-cragg.org/blog/post/right-way-to-do-ajax-is-declaratively/#comment-507">build your DOM</a>
from the top using Javascript! Or if you had to set all your styles in Javascript
instead of using declarative CSS!
</p><p>
<b>eA:</b> Well I&#39;ve seen some pretty ghastly examples of <i>those</i> two crafts! 
</p><p>
And many failed attempts to allow non-programmers or business analysts to program
directly.
</p><p>
<b>DC:</b> True, but that doesn&#39;t change the fact that most non-programmers can only 
think declaratively - they know What they want, but they haven&#39;t got much of a clue How
to get it.
</p><p>
Business people talk business rules and business data.
</p><p>
<b>eA:</b> We just can&#39;t program with them!
</p><p>
<b>DC:</b> Well, perhaps we just haven&#39;t found the best discipline of pragmatic formalisms
and methodology that will allow those rules to easily become programs.
</p><p>
It&#39;s a 
<a href="http://duncan-cragg.org/blog/post/right-way-to-do-ajax-is-declaratively/">well-supported claim</a>,
though, that declarative programming is simpler, clearer and more productive than imperative.
</p><p>
<b>eA:</b> OK - so how would you actually define these business rules?
</p><p>
<b>DC:</b> You could use a rules engine, or a DSL engine, or even XSLT - if that works for
you. There are 
<a href="http://en.wikipedia.org/wiki/XML_transformation_language">many ways to transform XML</a>.
</p><p>
<b>eA:</b> How would <i>you</i> do it?
</p><p>
<b>DC:</b> I would like to have an XML rewriting and templating system: &quot;if this XPath
or XML template matches Observed XML resource A, this one matches resource B and this
one matches myself, rewrite this and that bit of myself with these bits from A and B&quot;.
</p><p>&#160;</p><p>
<b>Web Objects Ask, They Never Tell</b>
</p><p>
<b>eA:</b> So you want to go around re-creating huge XML documents all the time?
</p><p>
<b>DC:</b> Who said anything about huge? This is another Web thing that doesn&#39;t necessarily
apply to us in REST integration: we don&#39;t need the equivalent of the giant, monolithic
HTML page. We can work in much smaller chunks.
</p><p>
I&#39;d even just call them &#39;objects&#39; rather than resources. Or &#39;Web objects&#39;, if you like. 
</p><p>
They could be little 
<a href="http://duncan-cragg.org/blog/post/content-types-and-uris-rest-dialogues/">XHTML carriers of Microformats</a>.
</p><p>
<b>eA:</b> I thought we&#39;d given up on distributing fine-grained objects back in the 
CORBA days?
</p><p>
<b>DC:</b> Ah, but this isn&#39;t trying to transparently distribute zillions of method 
calls in an RPC model. 
</p><p>
This is about optimising state transfer. Only send what you need, cache where you can,
push when something changes. Separate your data by rate of change, timeliness, cacheability.
</p><p>
<b>eA:</b> So these Web objects don&#39;t have any methods?  Because that would be RPC when
distributed?
</p><p>
<b>DC:</b> Exactly. In REST integration, the Web objects Ask, they never Tell! These Web
objects are reactive: Asking for public state, not Telling each other what to do.
</p><p>
<b>eA:</b> You mean the opposite of
<a href="http://www.pragprog.com/articles/tell-dont-ask">Tell Don&#39;t Ask</a>?
</p><p>
<b>DC:</b> Yes. As an object, you don&#39;t Tell another object How to do something, you Ask for
What you want by either simply Observing its public state or by it Observing yours, then
letting it decide How to evolve by itself. You then watch it and react or interact.
</p><p>
It&#39;s the &quot;imperative to declarative inversion&quot;: everything is turned upside-down or
inside-out when you distribute things this way!
</p><p>
<b>eA:</b> Oh yes, your &quot;inevitable inversion&quot; thing.
</p><p>
<b>DC:</b> Another indication of this inversion from the imperative object-oriented world
to the declarative ROA world is how the derided &#39;train wrecks&#39; of object-orientation now
become the essential XPaths of the object Web. 
</p><p>
You could say we have no methods, only &#39;getters&#39;, and XPath &#39;train wrecks&#39; are encouraged!
</p><p>
<b>eA:</b> Doesn&#39;t sound too safe to me - it breaks encapsulation, doesn&#39;t it?
</p><p>
<b>DC:</b> Well, it&#39;s actually safe to dig around, since the data is held in shape by a
stable, open, public schema.  You&#39;re expected to go traversing the tree.
</p><p>
And you get excellent encapsulation since Web objects are total masters of their own
destiny: they privately control the evolution of that public state. 
</p><p>
You very much retain the value of &#39;What not How&#39;; in fact, in a much better-defined way
since it&#39;s fundamentally baked in to the programming model.
</p><p>&#160;</p><p>
<b>Hyperdata as the Engine of Object State</b>
</p><p>
<b>eA:</b> But when you write &#39;train wrecks&#39; you often end up jumping from object to
object. How do your object Web XPaths do that, assuming they want to?
</p><p>
<b>DC:</b> <a href="http://en.wikipedia.org/wiki/Hyperdata">Hyperdata</a> of course! Links to links
around the Web. Objects can have their opaque UUIDs or GUID object handles encoded into
their URIs. Then objects can be wired up with XHTML links.
</p><p>
<b>eA:</b> So now your XPath transparently jumps these links?!
</p><p>
<b>DC:</b> Actually, yes! That would then allow us to dynamically break up data into more
manageable chunks without breaking the XPaths that traverse it.  
</p><p>
Also, with this approach, you still get to drill down to data like in transparent URI
paths, but you now use XPaths that are properly a part of the content layer, jumping
transparently <i>over</i> those opaque inter-object URIs.
</p><p>
<b>eA:</b> Would you use these &#39;jumping XPaths&#39; in the rewrite rules you said you wanted?
</p><p>
<b>DC:</b> Of course. Either linear XPaths, or XPath-like XML tree templates on the
left-hand side of a rewrite rule. 
</p><p>
You&#39;d start a template match on yourself, then continue on to match other objects by
jumping over links, then on and on from object to object.
</p><p>
<b>eA:</b> So I suppose any such jump to another object means you then need to start
Observing it, right?
</p><p>
<b>DC:</b> Exactly. And if hyperlinks are the only way you can find other objects to
Observe, it brings us to the following:
</p><p>
<i>Your object&#39;s next public state depends only on its current public state and the states
of those objects that are visible to it through hyperlinks.</i>
</p><p>
<b>eA:</b> Sounds a bit like the &quot;Hypertext As The Engine Of Application State&quot; constraint
of REST.
</p><p>
<b>DC:</b> Exactly! Except now that we&#39;re doing REST symmetrically - now that clients can
be servers, too - client Application State can have its own URIs!
</p><p>
<b>eA:</b> So you could re-phrase this as the even more intimidating: &quot;Hyper<i>data</i> As The
Engine Of Application <i>Resource</i> State&quot;!
</p><p>
<b>DC:</b> Well - how about just &quot;Hyperdata As The Engine Of Object State&quot;?!
</p><p>
<b>eA:</b> So do I have to wait for this link-jumping XML rewrite engine of yours to
express my business logic, in order to get &quot;Hyperdata As The Engine Of Object State&quot;?
</p><p>
<b>DC:</b> No, of course not! Use a nice, dynamic, XML-talking language, like Scala, and
follow the same principle, perhaps using a DSL.
</p><p>
<b>eA:</b> Can&#39;t you have objects that <i>aren&#39;t</i> entirely dependent on others? Like those
that represent external state?
</p><p>
<b>DC:</b> Of course. That&#39;s normal Web stuff. It&#39;s probably best to keep these &#39;pure&#39;: to
have either fully-interdependent objects driven by Hyperdata, or fully externally-driven
ones.
</p><p>&#160;</p><p>
<b>Class, Extension, Instance and Behaviour</b>
</p><p>
<b>eA:</b> Right, so we&#39;ve got these little Web-mapped XHTML Microformat objects all linked
up and watching each other in an Observer Pattern. This object&#39;s state depends on that
linked object&#39;s state according to rewrite rules or a DSL.
</p><p>
So taking this mapping to objects one last step, I presume object &#39;class&#39; maps onto an XML
schema, XHTML Microformat specification or other content type?
</p><p>
<b>DC:</b> Yes. A public grammar in some form. Domain or business classes only, of course,
not low-level classes.
</p><p>
<b>eA:</b> So, does each standard Web object class or type have a standard set of rules
guiding its evolution or behaviour?
</p><p>
<b>DC:</b> Yes. If you see something and recognise its type, you can attempt to interact
with it according to its public specification, and it should, but needn&#39;t, react.
</p><p>
The public specification can define the expected behaviour in the RFC language of MUST
and SHOULD, like AtomPub. Or it can define it in rewrite rules!
</p><p>
<b>eA:</b> So then, how do I add my own business rules to a content type or &#39;class&#39;, if its
behaviour is standardised and meant to be stable and predictable?
</p><p>
<b>DC:</b> There are two ways you can make use of a generic standard, and both are forms of
layering or abstraction: 
</p><p>
You can &#39;mash up&#39; standard component instances with declarative configuration - just
using them as they are for your domain.
</p><p>
Alternatively, you can extend or subclass their standard structures and behaviour to
become themselves more domain-specific.  For example, rules can be overridden or their
right-hand sides merged.
</p><p>
Again, think of how AtomPub can be <i>used</i> in any domain that looks like time-ordered lists
of content; and how you can <i>extend</i> AtomPub without breaking unextended clients or servers.
</p><p>&#160;</p><p>
<b>The REST Observer Pattern</b>
</p><p>
<b>eA:</b> I think you need a memorable name for your symmetric-REST, &quot;Hyperdata As The
Engine Of Object State&quot; architectural style!
</p><p>
<b>DC:</b> How about the &quot;REST Observer Pattern&quot;?
</p><p>
<b>eA:</b> But a Pattern has to be a retro-fit to existing behaviour, and &quot;REST Observer&quot;
is quite new.
</p><p>
<b>DC:</b> I mean REST .. [<i>DC does double bunnie ears</i>] &quot;Observer Pattern&quot;!
</p><p>
<b>eA:</b> Have you got any worked examples of the REST Observer Pattern?
</p><p>
<b>DC:</b> Will have soon...
</p><p>
<i>(c) 2006-2009 Duncan Cragg</i>
</p><p>&#160;</p><p>
Coming soon: Worked examples of the REST Observer Pattern.
</p><p>
<i>Note that the opinions of our imaginary eBay Architect don&#39;t
necessarily represent or reflect in any way the official
opinions of eBay or the opinions of anyone at eBay.</i>
</p><p>
<i>Indeed, I can&#39;t guarantee that the opinions of our real blogger
necessarily represent or reflect in any way the official
opinions of Roy Fielding...</i>

</p>

            </div>
        </content>
    </entry>
    
    <entry>
        <id>http://duncan-cragg.org/blog/post/content-types-and-uris-rest-dialogues/</id>
        <title>Content-Types and URIs | The REST Dialogues</title>
        <published>2008-02-16T23:44:00Z</published>
        
        <updated>2008-02-16T23:44:00Z</updated>
        
        <link rel="alternate" type="text/html" href="http://duncan-cragg.org/blog/post/content-types-and-uris-rest-dialogues/" title="Content-Types and URIs | The REST Dialogues" />
        
        <category term="architecture" />
        
        <category term="declarative" />
        
        <category term="strest" />
        
        <category term="microformats" />
        
        <category term="dialogue" />
        
        <category term="rest" />
        
        <category term="atom" />
        
        <summary type="xhtml">
            <div xmlns="http://www.w3.org/1999/xhtml">

<p>

In an exclusive nine-part dialogue with <i>an imaginary eBay
Architect</i>, we present an accessible discussion of the 
REST vs. SOA issue.
</p><p>
Although eBay have what they call a &#39;REST&#39; interface, it is, in
fact, a 
<a href="http://duncan-cragg.org/blog/post/strest-service-trampled-rest-will-break-web-20/">STREST</a>
interface, and only works for a few of the many function calls
that they make available via SOAP (GetSearchResults, GetItem,
GetCategoryListings, etc).
</p><p>
In this <a href="http://duncan-cragg.org/blog/post/getting-data-rest-dialogues/">dialogue series</a>,
I argue the case for eBay to adopt a truly REST approach to
their integration API. 
</p><p>
<b>Part 6: Content-Types and URIs</b>
 &#160; ...
</p>

            </div>
        </summary>
        <content type="xhtml" xml:space="preserve">
            <div xmlns="http://www.w3.org/1999/xhtml">

<p>
</p><div class="summary"><p>
In an exclusive nine-part dialogue with <i>an imaginary eBay
Architect</i>, we present an accessible discussion of the 
REST vs. SOA issue.
</p><p>
Although eBay have what they call a &#39;REST&#39; interface, it is, in
fact, a 
<a href="http://duncan-cragg.org/blog/post/strest-service-trampled-rest-will-break-web-20/">STREST</a>
interface, and only works for a few of the many function calls
that they make available via SOAP (GetSearchResults, GetItem,
GetCategoryListings, etc).
</p><p>
In this <a href="http://duncan-cragg.org/blog/post/getting-data-rest-dialogues/">dialogue series</a>,
I argue the case for eBay to adopt a truly REST approach to
their integration API. 
</p><p>
<b>Part 6: Content-Types and URIs</b>
</p></div><p>
</p><p>
<b>eBay Architect:</b> OK, enough fancy REST or ROA interaction
patterns!  Let&#39;s get back to REST basics.
</p><p>
<b>Duncan Cragg:</b> That&#39;ll be content types and URIs, then.
</p><p>
<b>eA:</b> OK - I&#39;ve a question about your standard content types.
In particular, about Microformats.
</p><p>
<b>DC:</b> Go on.
</p><p>
<b>eA:</b> You keep on mentioning Microformats when offering examples
of content type standardisation. But Microformats are always
embedded into HTML (or, preferably XHTML). 
</p><p>
Are you suggesting somehow taking them out and using them
separately? Or do we have to always use them through a, possibly
inappropriate, document model schema?
</p><p>
<b>DC:</b> Microformats currently &#39;tunnel&#39; through mechanisms in XHTML
such as the class attribute. They themselves have distinct
model schemas, that ride on the document model schema.
</p><p>
<b>eA:</b> So can you use them apart from HTML?
</p><p>
<b>DC:</b> No, not really, although you can carry a single Microformat
in a single document carrier, then squeeze out any document model
content that isn&#39;t supporting the Microformat, perhaps leaving
enough that it still renders sensibly in a browser if anyone looks.
</p><p>
The Microformats people won&#39;t like you doing it, I&#39;m quite sure, but
if you and I want to exchange a pure hCard, hCalendar, hResume or
hReview, and nothing else, then we can use the minimal document 
model carrier, and have just one Microformat per resource.
</p><p>
<b>eA:</b> But why not use the original data schema, before it was
Microformatted?  Why not just use vCard and vCalendar?
</p><p>
<b>DC:</b> Or use Atom instead of hAtom! Of course, if vCard has an
XML representation, you could use that - as long as the constituency
of your clients is the right one and is big enough. There may be 
more code out there that &#39;gets&#39; hCard than an XML vCard. And some
Microformats - such as hResume and hReview - don&#39;t have an original
schema and are based on abstracting from common or prior behaviour.
</p><p>
This is REST integration we&#39;re talking about, where data, not
documents, are native, and we aim to search out the most popular
and most widely understood data schemas - even if carried over
documents - to maximise interoperability.
</p><p>
<b>eA:</b> OK, that seems fine. Although I&#39;d point out that REST doesn&#39;t
have the monopoly on interoperability. SOA does that too.
</p><p>
<b>DC:</b> Interoperability is best acheived by sharing millions of
URIs dereferencing to a handful of standard content types, with
interlinks across the Web of resources.  ROAs (Resource-Oriented
Architectures) do that. SOA doesn&#39;t.
</p><p>
<b>eA:</b> REST APIs don&#39;t always have to do it. In the previous
example you went through, eBay and gBay could offer REST interfaces
but not talk the same schemas and not allow cross-linking in the way
you described. Or talk the same schemas but not recognise each
other&#39;s Items and Offers.
</p><p>
<b>DC:</b> That would be walled-garden, silo-thinking. It&#39;s also &#39;API&#39; 
thinking. Just opening up a port to your application, even one with
correct use of GET and POST on well-organised domain URIs, isn&#39;t in
the spirit of REST, and certainly isn&#39;t good enough for REST
integration. 
</p><p>
In REST we always aim to adopt the same schemas, to aim explicitly
for interoperability. And linking between those resources, even
cross-site, is fundamental to the REST way of thinking.  If someone
offers you a &#39;REST API&#39; that uses unnecessary proprietary schemas
that miss obvious interlinking opportunities, especially across to
other sites, run away!
</p><p>
<b>eA:</b> Are there any real-world examples?
</p><p>
<b>DC:</b> A good, and ironic, example of this is Google&#39;s
<a href="http://code.google.com/apis/opensocial/">Open Social</a>, 
at least in its earlier releases, which fails to achieve true
cross-site openness even with a 
&#39;<a href="http://code.google.com/apis/opensocial/docs/dataapis.html">REST API</a>&#39;
and shared schemas, because sites don&#39;t cross-link or actually allow
data sharing. Also, the schemas are a 
<a href="http://code.google.com/apis/opensocial/docs/gdata/people/reference.html#Elements">strange extension of Atom</a>,
rather than using, for example, vCard as the basis for &#39;People Data&#39;.
</p><p>
This hopefully will be fixed as the &#39;REST API&#39; evolves and with the
work going on in groups such as 
<a href="http://www.dataportability.org">DataPortability</a>,
with agreement from the major operators.
</p><p>
<b>eA:</b> So much for the interoperability of <i>that</i> REST
interface.
</p><p>
<b>DC:</b> The heart of good REST interoperability is the acceptance of
standardised data at a &#39;foreign&#39; URI, and the re-publishing of that
foreign URI in your own standardised resources. It happens on the
Web all the time, of course.  We just need to copy the model for
REST integration.
</p><p>
Hypermedia and (more importantly, here) &#39;hyperdata&#39; is baked into
REST, but is an afterthought in SOA. ROAs create an interlinked
hyperdata landscape across sites and domains. I&#39;m using &#39;hyperdata&#39;
here in the sense of interlinked data resources in REST integration,
by analogy with hypermedia, not in its Semantic Web sense.
</p><p>
<b>eA:</b> Ah! But how do your little pure Microformat resources link
up into this hyperdata landscape? Microformats can&#39;t link to each
other, can they?
</p><p>
<b>DC:</b> It&#39;s true you may have to go and get involved in the
Microformats movement in order to help define how to link an
hCalendar event to a list of hCards of people attending. Or the
hCard of a company to a list of hCards of its board members. Or
an hReview to the hCalendar event being reviewed and the hCard
of its author. Or to include the XFN list of links to friends&#39;
hCards inside a person&#39;s own hCard.
</p><p>
One indication that there&#39;s something not ideal in Microformats is
the fact that you have to write someone&#39;s hCard out again and again
for every page or site they appear on. If you could just link to a
single hCard for that person it would be more efficient.
</p><p>
<b>eA:</b> But Microformats have a narrow charter: to decorate the
document model with semantics. Any links are just part of the 
hypertext Web. It sounds like you&#39;re trying to make some kind of
domain model out of them, with their <i>own</i> interlinks!
</p><p>
<b>DC:</b> Yup. When you start to think the data of REST integration,
the document carrier of Microformats and it&#39;s often superfluous
links can be a distraction. If the document links <i>are</i> relevant to
the Microformat, of if people would use links <i>within</i> the
Microformat if they were told what value it has, it would be worth
pulling them out into the Microformat definition itself. Then
enhancing in-browser Microformat parsers to follow links will
greatly enhance their utility.
</p><p>
All you have to do is find real-world examples, and 
<a href="http://microformats.org/discuss/mail/microformats-discuss/2007-September/010769.html">propose it</a>
on the
<a href="http://microformats.org/discuss/mail/microformats-discuss/2007-October/010833.html">Microformat lists</a>!
Meantime, reuse the schemas and keep all your extensions public and
backwards-compatible.
</p><p>
<b>eA:</b> What about all those &#39;rel-&#39; decorations? You know, rel-tag,
XFN, etc.
</p><p>
<b>DC:</b> Well, hAtom is the only Microformat that specifies nested
rel-links: rel-tag, rel-bookmark and rel-enclosure. Otherwise, each
Microformat is independent, and the rel-links are independent. Like
I said, it may be worth going to the Microformat community and
suggesting more such rel-links beyond hAtom.
</p><p>&#160;</p><p>
</p><p>
<b>URI Opacity</b>
</p><p>
<b>eA:</b> So this RESTful data landscape of data wired up with URIs:
it sounds a bit <i>hard</i>-wired: where do URIs as queries (and URI
templates) fit into that tight mesh?
</p><p>
<b>DC:</b> URI templates fall into exactly the same category as
standardised content types and schemas in terms of their level of
abstraction and location in the stack. In other words, the right
thing to do, if it&#39;s transparent URIs you want, is to standardise
search URI templates across sites of a type.
</p><p>
<b>eA:</b> This is getting complicated. It&#39;s hard enough to get 
agreement on the content types of resources, never mind on URI
formats as well!
</p><p>
<b>DC:</b> Indeed, and in fact, I believe that URIs should be opaque:
they already are to HTTP, but also in our data landscape, a URI
should point to a single, predictable resource.
</p><p>
<i>The mechanism of querying that dataspace should be separated out
from the mechanism of linking it up</i>.
</p><p>
<b>eA:</b> A bit like GUIDs?
</p><p>
<b>DC:</b> Exactly. In Enterprise applications, you often see GUIDs
(globally unique ids) being used, and never see them mixed up with
search strings!
</p><p>
Transparent, query or template URIs are either used to be helpful or
decorative, or are an acceptable optimisation, as long as you know
that it&#39;s tunnelling through or hijacking the URI for a quick query
string.
</p><p>
<b>eA:</b> Tunnelling? Hijacking? You&#39;ve dismissed a long-standing
convention, in the Web at least! How else do you do query fetches?
</p><p>
<b>DC:</b> A better solution is the query-POST-redirect pattern:
the client POSTs their query, then the server redirects them to a
linkable results resource on an opaque URI.
</p><p>
The POST query schema can then be properly standardised in a content
type, or &#39;templated&#39; in the REST integration equivalent of an HTML form.
</p><p>
It&#39;s an extra round trip, but only one IP packet in each direction;
a redirect or a GET can fit into a single IP packet - the cost is
only in the connection latency.
</p><p>
<b>eA:</b> Why not just return the state of the resource you&#39;re
redirecting to in the body of the redirect, to save even this
round-trip?
</p><p>
<b>DC:</b> Yes, you could do that. It&#39;s not something seen in the
hypermedia Web as far as I know, but this is REST integration, where
we&#39;re able to come up with new sub-protocols like this - where HTTP
response codes are often given much thought.
</p><p>
Further, the server can offer the option to snapshot this results
resource, so that it&#39;s still exactly the same whenever the link is
dereferenced - something you can&#39;t do with a query URI.
</p><p>
<b>eA:</b> What would Tim Berners-Lee say about this? Is it in the
spirit or letter of his vision for how HTTP and URIs should be
used?
</p><p>
<b>DC:</b> <a href="http://www.w3.org/DesignIssues/Axioms.html">I&#39;ve no idea</a>!
However, in my opinion, when Tim didn&#39;t separate the concepts of a
globally unique identifier returning exactly one resource from a
query string returning maybe none, one or many resources (in a
list), he started a good deal of unnecessary confusion, even if
non-fatal in practical terms.
</p><p>
The phrase &#39;hackable URIs&#39; sums up the situation.  We may have been
forced into creating slightly better user interfaces if the URI
textbox were taken away from browsers.
</p><p>
Make your interface your <i>content</i> and have good search and
information architecture to allow your (opaque) links to be
discovered. If you know that human users - or search engines - will
be interested in reading some links at the top of your information
architecture, then go ahead and use just a few simple, meaningful
addresses.
</p><p>
<b>eA:</b> You&#39;re venturing into controversy again! I&#39;m sure I keep
reading about designing nice URLs being good practice.
</p><p>
<b>DC:</b> There was a time when transparent URLs were 
<a href="http://www.useit.com/alertbox/990321.html">considered important</a>,
but now
<a href="http://franticindustries.com/blog/2007/01/28/google-is-the-new-http/">everyone just uses Google</a>!
All the energy that&#39;s put into 
<a href="http://blog.welldesignedurls.org/">URL good manners</a>
and systems of URI templating and naming is just a distraction from
the bigger effort of standardising content and defining schemas.
</p><p>
Opaque URIs keep content in the body where it can be given a
Content-Type, instead of the headers - the URL line.
</p><p>
This is related to my preference to put &#39;write methods&#39; such
as PUT and DELETE into the body instead of the URL line.
</p><p>
<b>eA:</b> How exactly?
</p><p>
<b>DC:</b> The URL line should have a definite target - an opaque,
globally-unique URI - and a content transfer direction - GET or
POST. 
</p><p>
The rest of the <i>application-level</i> interaction, including
anything that will affect state and any searching and querying,
should be in transferred bodies with standardised content types.
</p><p>
<i>(c) 2006-2008 Duncan Cragg</i>
</p><p>&#160;</p><p>
In Part 7: <a href="http://duncan-cragg.org/blog/post/business-conversations-rest-dialogues/">Business Conversations</a>.
</p><p>
<i>Note that the opinions of our imaginary eBay Architect don&#39;t
necessarily represent or reflect in any way the official
opinions of eBay or the opinions of anyone at eBay.</i>
</p><p>
<i>Indeed, I can&#39;t guarantee that the opinions of our real blogger
necessarily represent or reflect in any way the official
opinions of Roy Fielding...</i>
</p><p>

</p>

            </div>
        </content>
    </entry>
    
    <entry>
        <id>http://duncan-cragg.org/blog/post/google-micro-conference/</id>
        <title>Google Micro Conference</title>
        <published>2007-10-05T11:22:00Z</published>
        
        <updated>2007-10-05T11:22:00Z</updated>
        
        <link rel="alternate" type="text/html" href="http://duncan-cragg.org/blog/post/google-micro-conference/" title="Google Micro Conference" />
        
        <category term="web2.0" />
        
        <category term="atom" />
        
        <category term="ajax" />
        
        <category term="rest" />
        
        <category term="event-driven" />
        
        <category term="publishsubscribe" />
        
        <category term="p2p" />
        
        <category term="architecture" />
        
        <category term="declarative" />
        
        <category term="app" />
        
        <category term="microformats" />
        
        <category term="scalability" />
        
        <category term="json" />
        
        <category term="openid" />
        
        <category term="microweb" />
        
        <category term="google" />
        
        <summary type="xhtml">
            <div xmlns="http://www.w3.org/1999/xhtml">

<p>

Last night&#39;s 
<a href="http://osjam.truemesh.com/">Google London Open Source Jam</a>
(also <a href="http://www.red-bean.com/ospowiki/LondonOpenSourceJam05Talks">here</a>)
was on the subject of the &#39;Web&#39; (didn&#39;t they invent that? Oh no,
that was Microsoft).
</p><p>
This event has been getting better and better each time I&#39;ve
attended. There were some very interesting lightning talks held
together with a tight structure and plenty of chance to chat,
drink cold Leffe and eat cold pizza. And nick [<i>transatlantic
translation: &#39;steal&#39;</i>] the 
<a href="http://www.greenandblacks.com/uk/productdetails.php?pageid=27&amp;cid=6&amp;pid=11">Green &amp; Black&#39;s chocolate</a>.
</p><p>
An ideal Micro Conference...
 &#160; ...
</p>

            </div>
        </summary>
        <content type="xhtml" xml:space="preserve">
            <div xmlns="http://www.w3.org/1999/xhtml">

<p>
</p><div class="summary"><p>
Last night&#39;s 
<a href="http://osjam.truemesh.com/">Google London Open Source Jam</a>
(also <a href="http://www.red-bean.com/ospowiki/LondonOpenSourceJam05Talks">here</a>)
was on the subject of the &#39;Web&#39; (didn&#39;t they invent that? Oh no,
that was Microsoft).
</p><p>
This event has been getting better and better each time I&#39;ve
attended. There were some very interesting lightning talks held
together with a tight structure and plenty of chance to chat,
drink cold Leffe and eat cold pizza. And nick [<i>transatlantic
translation: &#39;steal&#39;</i>] the 
<a href="http://www.greenandblacks.com/uk/productdetails.php?pageid=27&amp;cid=6&amp;pid=11">Green &amp; Black&#39;s chocolate</a>.
</p><p>
An ideal Micro Conference...
</p></div><p>
I arrived late (it starts at 6pm) and spent some time catching up with
<a href="http://www.flickr.com/photos/92443667@N00/1488471991/in/set-72157602268864450/">ex-Thoughtworks colleagues</a>,
so I missed Dion &quot;Ajaxian&quot; Almaer&#39;s 
<a href="http://www.slideshare.net/dion/future-of-web-apps-google-gears">Google Gears slideset from FOWA</a>.  
Go there now and check it out.
</p><p>
Thus the first talk I saw
was a nifty piece of widgetry by Steven Goodwin called 
<a href="http://www.bluedust.com/minerva/">WARP</a>. In WARP, interacting with a page of
&#39;applets&#39; changed the URL to encode those applets&#39; current state. If
you link to the current page, it will always show that state.
Very long URLs, you can imagine. None of that fancy Ajax stuff.
RESTful, dare I say. Nice API server-side for unpacking your
applet params. 
</p><p>
A trip to the lavatories [<i>transatlantic translation:
&#39;restroom&#39;/&#39;bathroom&#39;</i>] revealed that they are, indeed, doing that
<a href="http://googletesting.blogspot.com/2007/01/introducing-testing-on-toilet.html">Testing in the Toilet</a>
project in Google. It works, too! I learned something. Other intelligence on
Google&#39;s Inner Workings include confirmation of the beanbags and of
the high quality, free grub to which I have already alluded.
</p><p>
A nice bloke from Yahoo! (<a href="http://kid666.com/blog">Tom Hughes-Croucher</a>:
another spy?) came along to sell his idea that, in the
collaborative world of open-minded hackers, we who run websites
could help each other with our 404s. If I get a 404, I use the
referrer link to tell you, via some RESTful POST, that your link to
me is bust (assuming I don&#39;t intend to fix it myself).
</p><p>
I think the world is a little more selfish, so you need to decide
who hurts more - the site who sends their visitors to a dead-end,
or the site delivering that dead-end to a new visitor. I suspect
the latter, by a small margin, as it&#39;s not exactly a nice welcome.
So it&#39;s up to them to let the new visitor down more gently, and to
notify the publisher of the broken link with little or no cost to
them. For example, a really sociable 404-ing site could just
redirect the hapless visitor back to the referring page, adding
&#39;?broken=links&#39; to the URL - hopefully to be picked up by log
scanning scripts at the referring site.
</p><p>
Next up, <a href="http://duncan-cragg.org/">yours truly</a> taking 
<a href="http://www2007.org/prog-Developers.php#saturday">yet another chance</a>
to promote his excellent 
<a href="http://the-u-web.org">Micro Web</a> thingy. 
Couple of people asked about it afterwards - including that nice
chap from Yahoo! Also, a smart - and nice - chap called Toby 
(<a href="http://www.thetobe.com/">this one?</a>) got me into a deep discussion
on imperative vs. event-driven vs. state-driven programming. He was
apparently an old-timer like me, as he was able to engage in
dewy-eyed Functional Programming recollections. I managed to give
out about four full colour printouts about the
<a href="http://the-u-web.org">Micro Web</a>, 
and to collect some good calling cards.
</p><p>
However, <a href="http://joe.truemesh.com">Joe Walnes</a>, even a pint down in
the pub afterwards, still refused to sign up for Micro Web duties.
This in spite of over three years of intensive lobbying, including
eight months of me working Trojan-horse-like in his kitchen, on The 2005
Implementation.
</p><p>
Another ex-Thoughtworks colleague, 
<a href="http://www.pubbitch.org/blog">Simon Stewart</a>
took yet another chance to promote his promising
<a href="http://code.google.com/p/webdriver/">Webdriver</a> thingy. And a very
interesting project it is becoming. Still needs more work - on IE
support, etc - but I&#39;ll probably be using it in my new job at the
<a href="http://www.ft.com">Financial Times</a>.
</p><p>
Another ex-Thoughtworks colleague, 
<a href="http://abc.truemesh.com/">Chris Matts</a> took a chance to promote
his and Andy Pols&#39; interesting new
<a href="http://demo.pols.co.uk/dream/">Dream Machine</a> thingy.
Perhaps a bit like <a href="http://www.cambrianhouse.com">Cambrian House</a> - you put 
your dreams and ideas into it and people expand on them.
Chris is a natural on-stage - and even used the age-old trick of
promising lots of money for no effort, to get our attention at the start.
</p><p>
All I could come up with for the <a href="http://the-u-web.org">Micro Web</a>
was &#39;Cheaper, Wider, Faster&#39;...
</p><p>&#160;</p><p>
<i>Updated: added reference to Dion Almaer, details about WARP, swapped in the 
picture of TWers that I was waiting for and fixed a minor blunder thanks to that 
ever-sharp ThoughtWorker,  
<a href="http://dan.bodar.com/">Dan Bodart</a>..</i>

</p>

            </div>
        </content>
    </entry>
    
    <entry>
        <id>http://duncan-cragg.org/blog/post/how-ruby-can-enable-web-20-platform/</id>
        <title>How Ruby can enable the Web 2.0 Platform</title>
        <published>2007-06-26T15:17:00Z</published>
        
        <updated>2007-06-26T15:17:00Z</updated>
        
        <link rel="alternate" type="text/html" href="http://duncan-cragg.org/blog/post/how-ruby-can-enable-web-20-platform/" title="How Ruby can enable the Web 2.0 Platform" />
        
        <category term="django" />
        
        <category term="web2.0" />
        
        <category term="atom" />
        
        <category term="ajax" />
        
        <category term="yaml" />
        
        <category term="rest" />
        
        <category term="event-driven" />
        
        <category term="publishsubscribe" />
        
        <category term="architecture" />
        
        <category term="declarative" />
        
        <category term="socialsoftware" />
        
        <category term="strest" />
        
        <category term="app" />
        
        <category term="microformats" />
        
        <category term="scalability" />
        
        <category term="json" />
        
        <category term="openid" />
        
        <category term="redux" />
        
        <category term="ruby" />
        
        <summary type="xhtml">
            <div xmlns="http://www.w3.org/1999/xhtml">

<p>

<a href="http://www.oreillynet.com/pub/a/oreilly/tim/news/2005/09/30/what-is-web-20.html">Web 2.0&#39;s definition</a>
includes seeing the Web as an application platform. Which means it
is in competition with Java and .Net, and with SOA, for both local
and widely distributed applications.
</p><p>
If the Web is going to be a platform, the skills you need to learn
to program it are the core Web 2.0 technologies such as Ajax, JSON,
Atom, Microformats and OpenID.
</p><p>
And Ruby. This language, that&#39;s capturing the hearts of many Web 2.0
programmers, is ideal for easing the transition from the Java
and .Net platforms to the Web platform, as I will show.
</p><p>
Even if you&#39;re part of a big company that is generally immune to the
latest trends, the marriage of Ruby and the Web-as-platform may be
something to prepare for. It could even displace your SOA agenda...
 &#160; ...
</p>

            </div>
        </summary>
        <content type="xhtml" xml:space="preserve">
            <div xmlns="http://www.w3.org/1999/xhtml">

<p>
</p><div class="summary"><p>
<a href="http://www.oreillynet.com/pub/a/oreilly/tim/news/2005/09/30/what-is-web-20.html">Web 2.0&#39;s definition</a>
includes seeing the Web as an application platform. Which means it
is in competition with Java and .Net, and with SOA, for both local
and widely distributed applications.
</p><p>
If the Web is going to be a platform, the skills you need to learn
to program it are the core Web 2.0 technologies such as Ajax, JSON,
Atom, Microformats and OpenID.
</p><p>
And Ruby. This language, that&#39;s capturing the hearts of many Web 2.0
programmers, is ideal for easing the transition from the Java
and .Net platforms to the Web platform, as I will show.
</p><p>
Even if you&#39;re part of a big company that is generally immune to the
latest trends, the marriage of Ruby and the Web-as-platform may be
something to prepare for. It could even displace your SOA agenda...
</p></div><p>
Few would disagree that the Ruby language is riding the wave generated
by Ruby-on-Rails. In turn, Rails is riding the Web 2.0 wave, coming
as it does from underpinning the very Web 2.0 
<a href="http://www.37signals.com">37signals</a> 
product suite.  
</p><p>
Rails and Ruby have tapped into the tech Zeitgeist of friendly,
simple and powerful. The speed with which the Ruby and Rails
communities have delivered the key components of Web 2.0 is matched
by the speed at which 
<a href="http://radar.oreilly.com/archives/2007/05/state_of_the_co_10.html">Ruby and Rails books are leaving the shelves</a>.
</p><p>
What is the ideal platform of Web 2.0? Will it be Rails and Ruby?
Will Ruby ride the Web 2.0 wave into the mainstream in the same way
Java rode the Web 1.0 wave?
</p><p>
Well, here&#39;s the problem with that question: Web 2.0 is supposed to
be primarily about the <i>Web</i> itself as the platform, as 
<a href="http://www.oreillynet.com/pub/a/oreilly/tim/news/2005/09/30/what-is-web-20.html">explained first</a>
by Tim O&#39;Reilly and then by a thousand Web 2.0 vendors and industry
watchers after him.
</p><p>
Web-as-platform is not just vendor hype or pundit hand-waving.
Let&#39;s think about what O&#39;Reilly meant by that.
</p><p>&#160;</p><p>
<b>Web as Platform</b>
</p><p>
Web 2.0 is about making the Web more interactive, and thus able to
support applications where Java and .Net would once have been
considered the sole delivery platforms.
</p><p>
The fact that the technologies of the Web can be turned to this
use is a shift with far-reaching implications.
</p><p>
Broadly, the shift we are seeing is from the one-way, static
document delivery of Web 1.0 towards the two-way, dynamic data
exchange of Web 2.0.
</p><p>
This fundamental repurposing is delivering more complex, interactive
applications that work inside our browsers and which fully leverage
the benefits of online operation. 
</p><p>
Web 2.0 is bringing the user and their stuff <i>into</i> the very Web
that they hitherto only passively consumed.  This network-enablement
of the user in turn enables their <i>social</i> networking and their
shared creativity and self-expression. 
</p><p>
Web 2.0 has tapped into a deep human need - a fact reflected in the
vast traffic volumes and correspondingly vast valuations of Web 2.0
startups that we&#39;re currently seeing.
</p><p>
But Web 2.0 is not just for the startups: Enterprise Web 2.0 is
coming! The bigco.com site is going to be looking a little, well,
static and lifeless when compared to the new sites that are
springing up everywhere, and that most of BigCo&#39;s employees are
using. Further, BigCo can gain huge benefits from Web 2.0 approaches
empowering and connecting those employees on the Intranet. And that
Intranet is an ideal platform for deploying company-wide, interactive
applications.
</p><p>
This shift in the Web to two-way dynamic data is being powered by a
set of technologies that a Web platform programmer is going to have
to learn.
</p><p>&#160;</p><p>
<b>Web 2.0 Platform Technologies</b>
</p><p>
Anything that claims to be an application platform must support
data. Web 2.0 is above all the data Web. Web 2.0 is about
semantics, not free text and font sizes. Hence, it inevitably starts
with data-oriented formats such as 
<a href="http://en.wikipedia.org/wiki/XHTML">XHTML</a>, 
<a href="http://www.yaml.org/">YAML</a> and 
<a href="http://json.org/">JSON</a>.  In Web 2.0
more than ever, we talk about data not documents and about
separating data from its presentation.  CSS is big in Web 2.0, for
good reason (not just for gradient fills). Inside the page of a
self-respecting Web 2.0 application, you&#39;ll often find 
<a href="http://microformats.org/">Microformats</a> - again, 
semantics in the page: publishing concise data of widely-understood
standard formats. Some of those Microformats may be 
<a href="http://support.technorati.com/support/siteguide/tags">tags</a>, and in
Web 2.0 the simplest and most powerful semantics are those little
pivot points in Webspace.
</p><p>
Again, if you&#39;re going to be a general purpose platform, you need to
be able to fetch, update, notify and display that data.  Web 2.0
integration usually happens via JSON data structures and 
<a href="http://en.wikipedia.org/wiki/Representational_State_Transfer">REST</a>
interfaces (some of which, especially those based on 
<a href="http://atompub.org/">AtomPub</a>,
are true REST).  Following on from the data-like pages we serve to
browsers, come the data-like feeds we publish to feed readers and to
other applications.  After feeds, the core technology that gives
Web 2.0 its dynamism and interactivity is 
<a href="http://en.wikipedia.org/wiki/Ajax_(programming)">Ajax</a> and 
<a href="http://en.wikipedia.org/wiki/DHTML">DHTML</a>, and
increasingly 
<a href="http://en.wikipedia.org/wiki/Comet_(programming)">Comet</a>
(server push to the browser). The core technology
that gives Web 2.0 its users is increasingly 
<a href="http://openid.net/">OpenID</a>.
</p><p>
All of the above are open technologies. You can do Web 2.0 without
proprietary technologies, just like Web 1.0. Indeed, keeping to the
principles that made the Web successful is also essential to the
success of Web 2.0. The Web platform is the first application
platform that has to consider scalability and interoperability, and
will ignore them at its cost.  I have written before about open
data, use of standard data formats and using REST properly to avoid
creating unscalable, walled-garden sites. You don&#39;t need Flash or
SilverLight, you don&#39;t need vast amounts of custom Javascript, you
don&#39;t need function calls tying you to your servers.
</p><p>&#160;</p><p>
<b>Programming the Web 2.0 Platform</b>
</p><p>
So, we&#39;ve got the dynamic data that you&#39;d expect of a would-be
platform. But how to drive changes in those data? How do we
program the Web platform to animate all this data?
</p><p>
All Rails programmers will know the above technology list; it comes
with the territory. The Web 2.0 Platform can be very succesfully
powered by Rails and Ruby. Ruby and Rails make Web 2.0
applications simple and quick to program, addressing many of the
needs of simple Web 2.0 applications out of the box. There&#39;s little
doubt that Ruby and Rails will have a secure future riding the
Web 2.0 wave.
</p><p>
However, for many Web 2.0 applications, programming may not even be
necessary, at least not in the procedural or imperative style
programmers expect. 
</p><p>
Look back to the early 90&#39;s: &#39;Web 1.0&#39; made a whole class of
applications easy to write without programming: applications for
navigating information. You just wrote in HTML, declaratively.
</p><p>
Now look back at the long path of evolution of Java, through J2EE,
Spring, AOP, IoC, Domain Driven Design, POJOs. All trying to
achieve the simple goal of &#39;remove all that MVC and persistence
stuff and let us concentrate on business or domain objects&#39;. But
they never quite seemed to get it right. 
</p><p>
But then Rails comes along, and has succeeded by simple virtue of
concentrating on easy manipulation of the 
&#39;<a href="http://www.oreillynet.com/pub/a/oreilly/tim/news/2005/09/30/what-is-web-20.html?page=3">Intel Inside</a>&#39;
of Web 2.0 - data. 
</p><p>
It&#39;s reminiscent of the 
&#39;<a href="http://nakedobjects.org/wiki/Main_Page">Naked Objects</a>&#39;
approach to application building with minimal programming (just
business or domain code in POJOs that expose state into the GUI and
are transparently persisted). The 
<a href="http://ajaxian.com/archives/streamlined-naked-objects-for-the-web">Streamlined</a>
project takes Rails even further down this path. Rails&#39; nearest
competitor, <a href="http://www.djangoproject.com/">Django</a>,
has an admin interface that works in a similar way, automatically
generating edit pages based on the data model.
</p><p>
Web 2.0 is about data, about semantics. Web 2.0 is inherently
declarative.  So Web 2.0 applications can be written declaratively -
Web 2.0 mashups can be just wired together and their data animated
by business rules. A bit like programming spreadsheets. 
</p><p>
<a href="http://www.techcrunch.com/2007/03/02/5-ways-to-mix-rip-and-mash-your-data/">Teqlo</a>, 
<a href="http://www.techcrunch.com/2007/04/16/coghead-announces-17000-developers-building-applications-visually/">Coghead</a>, 
<a href="http://www.techcrunch.com/2007/03/02/5-ways-to-mix-rip-and-mash-your-data/">Pipes</a>, 
<a href="http://www.techcrunch.com/2006/03/11/dabbledb-online-app-building-for-everyone/">DabbleDB</a>, 
<a href="http://www.techcrunch.com/2007/06/19/new-site-jumps-into-the-application-creation-space/">LongJump</a>, 
<a href="http://www.techcrunch.com/2007/05/18/microsoft-launches-popfly-mashup-app-creator-built-on-silverlight/">Popfly</a>, 
<a href="http://www.techcrunch.com/2006/08/21/salesforce-dives-deep-into-google-adwords/">AppExchange</a> and
<a href="http://www.techcrunch.com/2006/04/30/wyaworks-app-builder-for-non-coders/">Wyaworks</a> 
are all examples of the different ways to program the new Web 2.0
platform without imperative code.
</p><p>
That&#39;s what we mean by Web-as-platform - not only is the underlying
programming language irrelevant, it will often not even be needed,
certainly for simple data manipulation applications and for many
simple mashups. Being RESTful gives you a massive head start in
this, of course.
</p><p>
While Rails is already in the game with its innate understanding of
Web 2.0 techniques and philosophies, Ruby itself has a huge amount
to offer the would-be declarative programmer, who is making the
transition to this new Web platform from their traditional Java
or .Net platform.  In particular, it is easy to write your domain
logic in a declarative style in Ruby: they call them &#39;DSLs&#39; these
days, but the idea is the same in most examples I&#39;ve seen.
</p><p>&#160;</p><p>
<b>Web 2.0 - The Web Redux</b>
</p><p>
Now, if you&#39;ve been following this blog, you&#39;ll know I have a
few opinions on 
<a href="http://duncan-cragg.org/blog/post/right-way-to-do-ajax-is-declaratively/">Declarative Web 2.0</a> and on
<a href="http://duncan-cragg.org/blog/post/distributed-observer-pattern-rest-dialogues/">patterns for programming REST</a>.
Essentially I argue that, if you want to play in the Web 2.0
platform game, you don&#39;t want to be writing screeds of Javascript
functions that call more functions on your servers. 
</p><p>
I recently presented some ideas along these lines at
the WWW2007 conference, entitled 
&#39;<a href="http://www2007.org/prog-Developers.php#saturday">The Micro Web: putting the Web back into Web 2.0</a>&#39;,
where I also showed a demo written in Python.
</p><p>
This approach combines my 
<a href="http://duncan-cragg.org/blog/post/distributed-observer-pattern-rest-dialogues/">Distributed Observer Pattern</a>
with Comet push to enable highly dynamic Web 2.0 applications to be
coded RESTfully and declaratively, with zero Javascript.  The
Distributed Observer Pattern offers a clean programming model for
animating the Web 2.0 dynamic-data technology set I described above. 
</p><p>
I believe the Observer Pattern is core to the way we&#39;ll be
programming when the Web 2.0 Platform hits mainstream.  It enables
the kind of event- and rule-driven programming that matches the
characteristics of the Web 2.0 dynamic data platform. As a 
further killer benefit, it also directly addresses the optimal
utilisation of multicore processors.
</p><p>
I am currently porting my Python implementation of this approach to
Ruby, in the
<a href="http://rubyforge.org/projects/redux/">Redux</a> 
project on Rubyforge.  Redux stands for &#39;Ruby Event-Driven Update
Exchange&#39;.  It uses the highly scalable
<a href="http://rubyforge.org/projects/eventmachine">EventMachine</a>
epoll-based event loop to power its event-driven architecture.
This will be essential when Redux is asked to scale up a 
Comet-based application.
</p><p>
Like Rails, Redux will be a Web (2.0) application framework, but
unlike Rails, it puts the Observer Pattern and event- and
rule-driven programming at its core. 
</p><p>
Redux&#39;s headline is &#39;Web 2.0 in-a-box&#39; or &#39;Naked Objects on the Web&#39;.
</p><p>&#160;</p><p>
<b>Conclusion</b>
</p><p>
If you&#39;re in BigCo, and are responsible for setting BigCo&#39;s
technical strategy, then train your Java devs up on Web 2.0 core
technologies such as Ajax, JSON, Atom, Microformats and OpenID.  
</p><p>
And fire up their enthusiasm by tapping into Ruby (perhaps via
JRuby) on your way to the Web 2.0 platform. 
</p><p>
Learn patterns for mashing and integrating. Learn about REST and
event- and rule-driven programming, including declarative DSLs.
</p><p>
When this Web platform hits BigCo, you will probably find that its
REST or ROA style make your SOA integration strategy look rather
complex and unweildy.
</p><p>
Check out the
<a href="http://duncan-cragg.org/blog/post/distributed-observer-pattern-rest-dialogues/">Distributed Observer Pattern</a>,
and download
<a href="http://rubyforge.org/projects/redux/">Redux</a>
when it&#39;s done (I&#39;ll let you know if you subscribe here!).
</p><p>
In 2007 and beyond, its the Web itself that&#39;s the platform, not
Java or .Net. But if you want to get there via a language-based
platform, Ruby could be the best way to transition to it.
</p><p>
<i>Note: Everything I said about Ruby and Rails applies equally in
technical terms to Python and Django, but regardless of the
significant benefits of the latter, Ruby and Rails have the Web 2.0
market and mindshare. I&#39;ll probably switch this blog from Django to
Redux sometime this year..</i>
</p><p>
<i>(c) 2007 Duncan Cragg</i>
</p><p>

</p>

            </div>
        </content>
    </entry>
    
    <entry>
        <id>http://duncan-cragg.org/blog/post/distributed-observer-pattern-rest-dialogues/</id>
        <title>The Distributed Observer Pattern | The REST Dialogues</title>
        <published>2007-06-20T22:42:00Z</published>
        
        <updated>2007-06-20T22:42:00Z</updated>
        
        <link rel="alternate" type="text/html" href="http://duncan-cragg.org/blog/post/distributed-observer-pattern-rest-dialogues/" title="The Distributed Observer Pattern | The REST Dialogues" />
        
        <category term="architecture" />
        
        <category term="declarative" />
        
        <category term="strest" />
        
        <category term="publishsubscribe" />
        
        <category term="app" />
        
        <category term="microformats" />
        
        <category term="dialogue" />
        
        <category term="event-driven" />
        
        <category term="rest" />
        
        <category term="atom" />
        
        <summary type="xhtml">
            <div xmlns="http://www.w3.org/1999/xhtml">

<p>

In an exclusive nine-part dialogue with <i>an imaginary eBay
Architect</i>, we present an accessible discussion of the 
REST vs. SOA issue.
</p><p>
Although eBay have what they call a &#39;REST&#39; interface, it is, in
fact, a 
<a href="http://duncan-cragg.org/blog/post/strest-service-trampled-rest-will-break-web-20/">STREST</a>
interface, and only works for a few of the many function calls
that they make available via SOAP (GetSearchResults, GetItem,
GetCategoryListings, etc).
</p><p>
In this <a href="http://duncan-cragg.org/blog/post/getting-data-rest-dialogues/">dialogue series</a>,
I argue the case for eBay to adopt a truly REST approach to
their integration API. 
</p><p>
<b>Part 5: The Distributed Observer Pattern</b>
 &#160; ...
</p>

            </div>
        </summary>
        <content type="xhtml" xml:space="preserve">
            <div xmlns="http://www.w3.org/1999/xhtml">

<p>
</p><div class="summary"><p>
In an exclusive nine-part dialogue with <i>an imaginary eBay
Architect</i>, we present an accessible discussion of the 
REST vs. SOA issue.
</p><p>
Although eBay have what they call a &#39;REST&#39; interface, it is, in
fact, a 
<a href="http://duncan-cragg.org/blog/post/strest-service-trampled-rest-will-break-web-20/">STREST</a>
interface, and only works for a few of the many function calls
that they make available via SOAP (GetSearchResults, GetItem,
GetCategoryListings, etc).
</p><p>
In this <a href="http://duncan-cragg.org/blog/post/getting-data-rest-dialogues/">dialogue series</a>,
I argue the case for eBay to adopt a truly REST approach to
their integration API. 
</p><p>
<b>Part 5: The Distributed Observer Pattern</b>
</p></div><p>
</p><p>
<b>eBay Architect:</b> So, can you summarise your argument that &#39;REST
isn&#39;t just about reading and writing data&#39;, and explain your
view on RESTful business logic?
</p><p>
<b>Duncan Cragg:</b> OK. The whole collection of related resources
determines where things stand at any given time. 
</p><p>
Resources are masters of their own destiny - guided by rules
declared in the standard to which their content type conforms.
</p><p>
These rules, or business logic, run on notification of any
declarations of the state of peer resources, or on arrival of
any state via POST. Such peer states and POSTs are <i>not</i>
commands, although it is possible to go ahead and define a 
special command or edit command content type.
</p><p>
The rules aim to satisfy the business or domain constraints on
the mutual states of these resources - updating and creating
resources accordingly and causing appropriate side-effects
outside the server, such as financial transactions and emails.
</p><p>
These transformations are state driven. Even though the
&#39;tension&#39; in unresolved rules may be <i>detected</i> by events,
that tension <i>exists</i>, not in those events as such, but in
resource state.
</p><p>
<b>eA:</b> That sounds like a core difference to SOA.
</p><p>
<b>DC:</b> Indeed. It&#39;s a Resource-Oriented Architecture. And ROAs
are declarative, not imperative like SOAs.
</p><p>
We have a world of resources declaring their current state, and
resources settling into new states depending on the current
state of related resources. These state changes can be
driven by hard-coded resource animation logic, or by simpler,
clearer, more scalable, declarative state transformation rules.
</p><p>
<b>eA:</b> Remind me of those patterns for notifying state change.
</p><p>
<b>DC:</b> Resource states are either polled via GET or actively
notified via POST.  Such actively POSTed state could be from a
resource that also happens to be GETable, could be simply a link to
such a resource, or could cause such a GETable resource to be
created on the target server.  Alternatively, the POSTed state
could be considered too transient to record in a GETable
resource, but can still trigger transformation in its target
resource.
</p><p>
The above eBay examples used the pattern of &#39;server creates
GETable copy of POSTed resource&#39;, and also &#39;second server
hosts GETable copy of POST-notified resource&#39;.
</p><p>
What I have described is a general programming model because,
in general, such simple, declarative, transformational
mechanisms are Turing Complete.
</p><p>
<b>eA:</b> I&#39;m sure it&#39;s a novel perspective - even to RESTians!
Again, do you have any high-level RESTian support for this?
</p><p>
<b>DC:</b> Any web resource that is a derivative of, or is dependent
on, one or more other resources is using this approach.
</p><p>
Like I said before, there is an example of a 
<a href="http://wellformedweb.org/story/1">similar approach by Joe Gregorio</a>
on his &#39;Well-Formed Web&#39; site for alerting resources to peer
resources of mutual interest.
</p><p>
Every time you would POST some data, consider making that data
GETable and POST its URI instead, as a notification of the data
existing. 
</p><p>
<b>eA:</b> GETable POST data? You sure that&#39;s REST-compliant?
</p><p>
<b>DC:</b> In REST integration, things become more symmetric 
than in the client-server Web, or rather, the &#39;client-resource&#39;
Web. We can start to talk about the &#39;resource-resource&#39; Web!
</p><p>
But anyway, we&#39;re already halfway to the symmetric resource-resource
Web when we POST - not to a <i>service</i>, but to a <i>URI</i>. Resources
can already both issue <i>and</i> receive state, which is a pretty
symmetric state of affairs. 
</p><p>
<b>eA:</b> I never thought of it that way - I keep forgetting that
you can POST right back to a resource you just fetched.
</p><p>
<b>DC:</b> But think one step on: the POSTed data has a Content-Type
but no URI!
</p><p>
Why not close the loop and have this POSTed data be a first-class
resource (with a URI) that POSTs <i>itself</i> to the target. And it can
<i>itself</i> GET that target or be POSTed to by that target in return.
</p><p>
That really is a Resource-Oriented Architecture. Once resources are
seen as equal and active participants in RESTful integration, it
becomes irrelevant whether their state is transferred by GET or by
POST.
</p><p>
<b>eA:</b> I&#39;m still having trouble with this pattern of POST just
being a pro-active GET.
</p><p>
<b>DC:</b> Making POSTed data GETable more correctly moves the
responsibility to the target resource to fetch the incoming resource
state when its ready (rather than being bombarded by state it hasn&#39;t
asked for).
</p><p>
Once the target is interested, updates can be POSTed directly as
they happen, to prevent the target polling, or notification of
an updated URI POSTed to trigger the target to re-GET the changed
resource when it wants (thereby updating the caches).
</p><p>
<b>eA:</b> Hmm - makes clients look like servers..
</p><p>
<b>DC:</b> Since our &#39;clients&#39; in REST integration are also &#39;servers&#39;
in other contexts, it is easier to set up client-side resources than
on the browser-based Web. One objection to cookies on the Web is
that they are state or resource that has no URI. So give your
&#39;client&#39; state a URI!  And put any client-specific server resources
on your own &#39;client&#39; host.
</p><p>
<b>eA:</b> Is anyone doing this sort of thing?
</p><p>
<b>DC:</b> Well, in fact there are many examples of this
POST-notification of a GETable resource already happening
between web sites.  Like submitting a link to your site to an
indexing engine and letting it crawl (or poll) it.
</p><p>
Trackback pings are another example: POST a URI along with a
sample of your page.  And the Microformat rel-tag adds your
article to Technorati&#39;s tag index when you ping their servers
with the URI of the article.
</p><p>
Further, imagine POSTing to some new site a link to your hCard
on your own server, to save you having to type your name and
address again. And you&#39;d never need to manually update sites
when your address changes: just ping &#39;em all.
</p><p>
<b>eA:</b> Ah - but I thought all URIs should be GETable. The ping URI
you&#39;re POSTing <i>to</i> in these examples isn&#39;t always one that you
can also GET!
</p><p>
<b>DC:</b> Indeed - so think how much more powerful it would be if
we did close the loop and provide or create a GETable resource to
POST these notifications to. 
</p><p>
For example, imagine a page containing an hCalendar event. Now point
to it with a rel=&quot;attending&quot; link.  When the hCalendar discovers
your intention (using a direct POST ping of your page&#39;s URI to the
hCalendar page&#39;s URI - or perhaps through the referrer trick from
people clicking through), it adds your referring page to a list of
attendees inside the hCalendar. The hCalendar could either contain
lists of backlinks to the attendee&#39;s pages, which may in turn carry
hCards, or it could contain lists of complete hCards copied over.
</p><p>
<b>eA:</b> Sounds like a good use of Microformats.
</p><p>
<b>DC:</b> These examples make crawling and polling (even with
If-Modified-Since <i>et al</i>) look like a clumsy version of the more
proactive POST. 
</p><p>
Web Feeds and general publish-subscribe are further examples where
POST may be used to notify changes on a resource - giving the feed
consumer first-class resource status with their own URI. 
</p><p>
<b>eA:</b> I&#39;d never think of using HTTP in this way.
</p><p>
<b>DC:</b> Obviously this only applies where the feed consumer is a
visible and POSTable server and where timeliness is crucial. And
probably where the number of subscribers is relatively small, unless
asynchronous I/O and an event-driven architecture are employed, and
you don&#39;t wait for the response to each POST.
</p><p>
This isn&#39;t done now simply because of the asymmetry of the current
Web, <i>an asymmetry which we are free of in REST integration</i>.
</p><p>
<b>eA:</b> What about all those REST rules about idempotent and unsafe
methods?
</p><p>
<b>DC:</b> We&#39;re not mixing GET and POST in that sense, just turning
the tables on the asymmetric Web.  GET is still cacheable, and we
can POST a link to cause a cached GET.
</p><p>
I believe this is a more-constrained REST style, not disjoint to
REST. It is at least an ROA! It may fall foul of REST&#39;s
client-server constraint, since we&#39;re now in server-server territory
with integration applications.  Also, the concept of &#39;Hypertext as
the Engine of Application State&#39; is something that may take some
refitting to the mutual state dependency model. However, I believe
it&#39;s most important to focus on maintaining the benefits of REST
and its key elements of standard content types at URIs.
</p><p>
I call this symmetric REST integration style the &#39;Distributed
Observer Pattern&#39;.
</p><p>
<b>eA:</b> Quickly summarise the &#39;Distributed Observer Pattern&#39;.
</p><p>
<b>DC:</b> OK, the Distributed Observer Pattern is &#39;symmetric REST&#39;. A
resource subscribes to a peer resource via a GET that supplies its
own URI, and is notified of subsequent state changes in that
resource through a POST back.
</p><p>
<b>eA:</b> That was <i>too</i> quick. Tell me the details!
</p><p>
<b>DC:</b> OK, here are four. First, a POST can be either the whole
new state or the fact of the change, allowing the subscriber to
GET the resource when it&#39;s ready (and thereby fill any caches).
</p><p>
Secondly, you can use either the Referer header or perhaps the
Content-Location header in POST and GET requests to indicate the
origin POSTer or GETter URI. Alternatively, you can send this origin
resource URI using the Cookie header, echoing its use in the normal
browser client-server case to identify the pseudo-resource of a
browser user.
</p><p>
POSTed state notifications may be unsolicited by a prior GET
subscription, when the POST target is clearly open to them (as in
the ping notification examples).  These can be seen as &#39;subscribe to
anyone&#39;, and may be combined with a corresponding &#39;GET anyone&#39;
crawling process, without explicit subscription.
</p><p>
Finally, POST notifications may be targetted to single resources to
ask them to update: the Distributed Observer Pattern way of
achieving the client-server editing function.  These now become
&#39;edit suggestions&#39; of the POSTer resource - putting the target back
in control of its own destiny and integrity.
</p><p>
<b>eA:</b> And why should I use the Distributed Observer Pattern?
</p><p>
<b>DC:</b> The Distributed Observer Pattern supports the programming model
of inter-dependent resources whose own state is a function of their
peers&#39; state, driven by declarative rules. It&#39;s a very general ROA
programming model.
</p><p>
<i>(c) 2006-2007 Duncan Cragg</i>
</p><p>&#160;</p><p>
In Part 6: <a href="http://duncan-cragg.org/blog/post/content-types-and-uris-rest-dialogues/">Content-Types and URIs</a>.
</p><p>
<i>Note that the opinions of our imaginary eBay Architect don&#39;t
necessarily represent or reflect in any way the official
opinions of eBay or the opinions of anyone at eBay.</i>
</p><p>
<i>Indeed, I can&#39;t guarantee that the opinions of our real blogger
necessarily represent or reflect in any way the official
opinions of Roy Fielding...</i>
</p><p>

</p>

            </div>
        </content>
    </entry>
    
    <entry>
        <id>http://duncan-cragg.org/blog/post/lighter-wins-2007/</id>
        <title>Lighter-than Wins in 2007</title>
        <published>2007-01-18T11:12:00Z</published>
        
        <updated>2007-01-18T11:12:00Z</updated>
        
        <link rel="alternate" type="text/html" href="http://duncan-cragg.org/blog/post/lighter-wins-2007/" title="Lighter-than Wins in 2007" />
        
        <category term="web2.0" />
        
        <category term="atom" />
        
        <category term="ajax" />
        
        <category term="yaml" />
        
        <category term="rest" />
        
        <category term="cyberspace" />
        
        <category term="architecture" />
        
        <category term="declarative" />
        
        <category term="identity" />
        
        <category term="app" />
        
        <category term="microformats" />
        
        <category term="json" />
        
        <category term="openid" />
        
        <category term="rajmo" />
        
        <summary type="xhtml">
            <div xmlns="http://www.w3.org/1999/xhtml">

<p>

What do all the MAJOR Web 2.0 technologies of 2007 have in
common? 
</p><p>
Let me list them first:
</p><pre>
    M.icroformats (including tags)
    A.jax (including Comet)
    J.SON (plus YAML)
    O.penID (plus SXIP, LID, Yadis)
    R.EST (including Atom, APP)
</pre><p>
What these technologies have in common is that they&#39;re
all <i>lighter</i> than their competitors:
</p><table class="two-col-table"><tr><td><p>Microformats </p></td><td><p> Lighter than the Semantic Web</p></td></tr>
<tr><td><p>Ajax </p></td><td><p> Lighter than Fat Client (!)</p></td></tr>
<tr><td><p>JSON </p></td><td><p> Lighter than XML</p></td></tr>
<tr><td><p>OpenID </p></td><td><p> Lighter than SAML/Liberty Alliance</p></td></tr>
<tr><td><p>REST </p></td><td><p> Lighter than SOA</p></td></tr>
</table><p>
 &#160; ...
</p>

            </div>
        </summary>
        <content type="xhtml" xml:space="preserve">
            <div xmlns="http://www.w3.org/1999/xhtml">

<p>
</p><div class="summary"><p>
What do all the MAJOR Web 2.0 technologies of 2007 have in
common? 
</p><p>
Let me list them first:
</p><pre>
    M.icroformats (including tags)
    A.jax (including Comet)
    J.SON (plus YAML)
    O.penID (plus SXIP, LID, Yadis)
    R.EST (including Atom, APP)
</pre><p>
What these technologies have in common is that they&#39;re
all <i>lighter</i> than their competitors:
</p><table class="two-col-table"><tr><td><p>Microformats </p></td><td><p> Lighter than the Semantic Web</p></td></tr>
<tr><td><p>Ajax </p></td><td><p> Lighter than Fat Client (!)</p></td></tr>
<tr><td><p>JSON </p></td><td><p> Lighter than XML</p></td></tr>
<tr><td><p>OpenID </p></td><td><p> Lighter than SAML/Liberty Alliance</p></td></tr>
<tr><td><p>REST </p></td><td><p> Lighter than SOA</p></td></tr>
</table><p>
</p></div><p>
I&#39;m reminded of Tim Bray&#39;s 
<a href="http://www.tbray.org/ongoing/When/200x/2004/01/03/TPM1">Technology Predictor Success Matrix</a>
and his appreciation of the 
<a href="http://www.tbray.org/ongoing/When/200x/2004/01/14/TPSM-8020">80:20 phenomenon</a>.
If hitting the sweet spot of achieving a lot with only a little
is the main test of potential, then these five Web 2.0
technologies are all set for success.
</p><p>
So it&#39;s no surprise to see Tim supporting
<a href="http://www.tbray.org/ongoing/When/200x/2006/06/07/Microformats">Microformats</a>
<a href="http://www.tbray.org/ongoing/When/200x/2006/01/08/No-New-XML-Languages">once or</a>
<a href="http://www.tbray.org/ongoing/When/200x/2005/10/06/Whats-Happening">twice</a>
and even
<a href="http://www.tbray.org/ongoing/When/200x/2006/12/21/JSON">JSON</a>,
in spite of his, um, XML background. He also understands and uses
<a href="http://www.tbray.org/ongoing/When/200x/2006/04/19/The-Cost-of-AJAX">Ajax</a>
and backs
<a href="http://www.tbray.org/ongoing/When/200x/2004/09/18/WS-Oppo">REST</a>
(in particular via <a href="http://www.tbray.org/ongoing/When/200x/2005/11/21/Atom-Status">Atom</a>).
Tim has not yet mentioned OpenID, instead referring to 
<a href="http://www.tbray.org/ongoing/When/200x/2006/04/28/SAML-Days">SAML</a> and 
<a href="http://www.tbray.org/ongoing/When/200x/2005/05/15/WS-Federation">Liberty Alliance</a>
(please don&#39;t be crass by leaving a comment speculating on the reason for this...).
</p><p>
These MAJOR Web 2.0 technologies should form the basis of
the two-way, interactive data Web or the Web-as-a-platform
vision that we&#39;ve all been promised.
</p><p>
However, they will need taking a little further this year, in
order to bring them closer together and to make this vision
happen in a seamless way.
</p><p>
A synergy between these 80:20 technologies can potentially
produce much more than just the &#39;next version of the Web&#39;, if
engineered well.
</p><p>
I have already discussed the 
<a href="http://duncan-cragg.org/blog/post/microformats-challenge-web-feeds-and-web-apis/">Subversive Microformat</a>,
I&#39;ve promoted
<a href="http://duncan-cragg.org/blog/post/right-way-to-do-ajax-is-declaratively/">Declarative Ajax</a>
and currently I&#39;m slowly working up to 
<a href="http://duncan-cragg.org/blog/post/getting-data-rest-dialogues/">Symmetric REST</a>.
</p><p>
Next up, I&#39;ll be asking you to consider a web of
<a href="http://www.google.com/search?q=json+microformat&amp;num=100">JSON Microformats</a>
and ways to merge
<a href="http://www.google.com/search?q=hcard+openid&amp;num=100">hCard and OpenID</a>
into active user personas - even avatars...
</p><p>
<i>I&#39;ll tag this acronym as &#39;<a href="http://technorati.com/tag/rajmo">rajmo</a>&#39;
instead of &#39;major&#39;, for obvious reasons.</i>
</p><p>

</p>

            </div>
        </content>
    </entry>
    
</feed>

