<?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 'p2p'</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/p2p/" />

    <updated>2007-10-05T11:22:00Z</updated>


    <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/inter-enterprise-rest-integration-rest-dialogues/</id>
        <title>Inter-Enterprise REST Integration | The REST Dialogues</title>
        <published>2007-04-08T13:38:00Z</published>
        
        <updated>2007-04-08T13:38:00Z</updated>
        
        <link rel="alternate" type="text/html" href="http://duncan-cragg.org/blog/post/inter-enterprise-rest-integration-rest-dialogues/" title="Inter-Enterprise REST Integration | The REST Dialogues" />
        
        <category term="architecture" />
        
        <category term="declarative" />
        
        <category term="strest" />
        
        <category term="p2p" />
        
        <category term="app" />
        
        <category term="dialogue" />
        
        <category term="event-driven" />
        
        <category term="rest" />
        
        <category term="atom" />
        
        <category term="scalability" />
        
        <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 4: Inter-Enterprise REST Integration</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 4: Inter-Enterprise REST Integration</b>
</p></div><p>
</p><p>
<b>Duncan Cragg:</b> OK - I&#39;ve demonstrated how you can replace
imperative, function-call API-driving with a clean, declarative,
RESTful interaction, driven by simple business rules. 
</p><p>
We had servers run by eBay and clients run by the public, in the
same way your SOAP API is used.
</p><p>
<b>eBay Architect:</b> Ah: that&#39;s something SOA has that REST doesn&#39;t!
</p><p>
<b>DC:</b> What? What&#39;s that?
</p><p>
<b>eA:</b> Services are all about Enterprise Integration: about
servers talking to servers. In REST you&#39;re all about clients
talking to servers. The Web is essentially only browser clients
talking to Web servers. With Web Services, you can do more serious
Enterprise Integration.
</p><p>
<b>DC:</b> You never give up do you? So you want &#39;serious&#39; integration.
Is that within or between enterprises?
</p><p>
<b>eA:</b> Let&#39;s say between.
</p><p>
<b>DC:</b> Fine. We&#39;ll use the same example as before: it&#39;s just a
variation on the Patterns used.  
</p><p>
We can standardise a more general version of the eBay schemas for
Items, Offers, ResponseToBestOffers and so on. Anyone can put their
own Items, Offers, etc. up on their own servers, or on some public
auction service site.  Everyone can do auctions with eBay and with
anyone else who decides to set up. 
</p><p>
Even, say, a new Google auction site: let&#39;s call it &#39;gBay&#39;!
</p><p>
<b>eA:</b> Ha! OK, let&#39;s go through this slowly: you have eBay and
&#39;gBay&#39; sites, with sets of users on each. Now Ernie wants to sell
his old laptop on eBay, so creates a new Item for it.  Gordon is
registered to gBay and needs a cheap laptop.
</p><p>
<b>DC:</b> Great - well the first thing is search. As an interoperable
site, gBay offers a broad search across both gBay sale Items and
eBay ones - cached and indexed internally. The gBay search database
would be filled by crawling eBay URIs and even by running queries on
eBay.
</p><p>
<b>eA:</b> Mm. Have to check the T&#39;s &amp; C&#39;s...
</p><p>
<b>DC:</b> So Gordon on gBay finds Ernie&#39;s laptop on eBay. The
presentation of this eBay sale item will be given the gBay
style, but calling out directly to the eBay data and images.
</p><p>
<b>eA:</b> OK, now let&#39;s say Gordon decides to make an offer.
</p><p>
<b>DC:</b> So an Offer resource is created on <i>gBay</i> referring to the
laptop on eBay. Then through a notification, the Item on eBay is
alerted to this Offer.
</p><p>
<b>eA:</b> What&#39;s notified, to where?
</p><p>
<b>DC:</b> There&#39;s a number of possible patterns.  Before, we had the
pattern of POSTing a resource to a server that then creates the
GETable version.
</p><p>
However, now gBay is hosting the Offer, so the internal mechanisms
for notification are no longer available. 
</p><p>
So gBay could suggest an update through APP or a simpler POST to a
collection of Offer entries within the eBay Item to point to this,
now remote, Offer.
</p><p>
Perhaps the gBay Offer can simply be POSTed wholesale to the eBay
Item. 
</p><p>
Or just a link to it.
</p><p>
Or eBay may poll, read a feed or search gBay for new Offer URIs,
putting them into Offer lists as they come up. 
</p><p>
An unusual approach (thanks to 
<a href="http://wellformedweb.org/story/1">Joe Gregorio</a>)
would be for gBay to GET the eBay Item, with the Offer marked in a
Referer: header.
</p><p>
<b>eA:</b> Plenty of patterns to choose from. So there are some Offers
on eBay, some on gBay. The Item lists its Offers in a rank as before,
as they appear through this notification.
</p><p>
Now, let&#39;s say Ernie wants to accept Gordon&#39;s Offer on gBay. 
</p><p>
<b>DC:</b> OK, assuming he can see the Offers the same regardless of
host, he just chooses Gordon&#39;s Offer on the offer listing for his
Item and accepts it.
</p><p>
<b>eA:</b> So we need to create a ResponseToBestOffer on eBay.
</p><p>
<b>DC:</b> Yes. Now the patterns are reversed, because eBay needs to
notify gBay this time - of its ResponseToBestOffer. 
</p><p>&#160;</p><p>
</p><p>
<b>Pub-Sub and Observer Pattern</b>
</p><p>
<b>DC:</b> Again, it can do this by POSTing the ResponseToBestOffer to
each Offer on gBay in turn, or can POST the actual Item itself to
each Offer, where the Item has a link to the ResponseToBestOffer.
</p><p>
That would implement a logical subscription to the Item from each of
the Offers on it.
</p><p>
<b>eA:</b> It sounds to me like POSTing several times to implement this
pub-sub pattern is physically inefficient, even if it&#39;s logically
correct.  Especially when it&#39;s the same information repeated from
eBay to gBay servers.
</p><p>
<b>DC:</b> Yes, indeed: a single notification to gBay would be better,
letting gBay handle the propagation of subscription responses. This
would in effect treat gBay as a proxy cache, and the notification as
a cache invalidation event on gBay&#39;s copy of the eBay Item.
</p><p>
<b>eA:</b> What URI on gBay would you POST this eBay Item to?
</p><p>
<b>DC:</b> Something like <code> http://gbay.com/ebay.com/item/4243</code> - to a
copy of itself. You could also GET this cached copy if you wanted.
</p><p>
<b>eA:</b> OK, what next?
</p><p>
<b>DC:</b> In gBay the losing Offers get updated on receipt of this
ResponseToBestOffer state. Gordon&#39;s Offer gets set to &#39;won&#39;. In
eBay, all the losing Offers are updated to &#39;lost&#39;. The laptop Item
gets marked &#39;sold&#39;, with a link to the ResponseToBestOffer, which
links to the Offer that won.
</p><p>
It is possible to implement this internally in eBay (and that
pub-sub cache invalidation propagation in gBay) using the
<a href="http://en.wikipedia.org/wiki/Observer_pattern">Observer Pattern</a>.
and an event-driven server. 
</p><p>
<b>eA:</b> Makes sense - you mean something like 
<a href="http://www.eecs.harvard.edu/~mdw/proj/seda/">SEDA</a>?
</p><p>
<b>DC:</b> Yep.
</p><p>
So the Offers all subscribe to the Item to watch for its status
switching to &#39;sold&#39; and to see if they won.  Conversely, the Item
can subscribe to the Offers: maybe the Offers could change or be
withdrawn, and the Item needs to keep itself updated accordingly.
</p><p>
<b>eA:</b> Wow - symmetric subscription - the two-way Observer Pattern!
</p><p>
OK, what next?
</p><p>
<b>DC:</b> The eBay laptop Item resource will be further updated by its
owner with paid, shipped, refunded, etc., as it currently is within
eBay.
</p><p>
<b>eA:</b> Hold on, you&#39;re mixing patterns: you had the Observer
Pattern on the Item just now: the Item observes the Offers. 
The Offers&#39; state can be POSTed to the Item, whose own state may
then change according to its rules.
</p><p>
But you then mix patterns by allowing a POST directly to the Item
from the Item&#39;s owner, to update a couple of fields.
</p><p>
In one, the Item chooses what its state will be according to the
state of its peers, and in the other, it&#39;s told, not according to
a peer state, but some POST content type. 
</p><p>
That doesn&#39;t seem neat or symmetric.
</p><p>
<b>DC:</b> It&#39;s true that these interaction styles differ: the Observer
Pattern or pub-sub approach is peer-to-peer (resource-to-resource as
equals watching each other); and in this scenario it&#39;s also
server-to-server. 
</p><p>
The direct edit request is more a client-server pattern, where the
server resource - the Item - is considered under the control of a
client.
</p><p>
However, the Item is always in control of its own state, and can
even ignore a request by its owner if that request doesn&#39;t match its
internal integrity rules. 
</p><p>
The Item supporting both styles at the same time is absolutely fine.
</p><p>
Actually, you could see these two styles as aspects of the same
peer-to-peer pattern: introduce a resource in the client that
holds edit requests, to which the Item subscribes. It all ends up
being much the same.
</p><p>&#160;</p><p>
</p><p>
<b>Transactions, Trust</b>
</p><p>
<b>eA:</b> Right, now what if you have a race, where the
ResponseToBestOffer is created at the same time as an Offer is
changed or withdrawn?
</p><p>
Don&#39;t you need some kind of two-phase commit or distributed
transaction logic?
</p><p>
<b>DC:</b> Of course not. It&#39;s the same as in the real world: as long
as it all settles in the end and the rules are followed. The
ResponseToBestOffer cites what state of the Offer it is accepting.
If that changes for any reason, the ResponseToBestOffer is void.
</p><p>
It&#39;s about state and state consistency in REST, as opposed to the
SOA style of maintaining total control at all times.
</p><p>
There will be temporary states that trigger the rules and that need
to be resolved. That&#39;s the programming and distribution model.
Tolerance of transient states is what makes this model so robust.
</p><p>
<b>eA:</b> Surely there are some legal and contract issues?  How is
this exchange legally binding?
</p><p>
<b>DC:</b> You can digitally sign the Item, Offer and ResponseToBestOffer
resources, and each side needs to keep records of the history.  Then
it&#39;s down to agreements between eBay and gBay and the local laws in
force.
</p><p>
<b>eA:</b> What about buyer and seller ratings and feedback?
</p><p>
<b>DC:</b> Ernie in eBay and Gordon in gBay can happily publish
feedback about each other, and Ernie will be able to see Gordon&#39;s
rating via eBay&#39;s interface, or directly on gBay.  
</p><p>
As for aggregated ratings from several buyer/seller interactions: a
person&#39;s rating is a function of the ratings of all those they have
dealt with. These ratings can be fetched by GET from remote sites,
and combined with internally-held ratings, depending on the trust of
one site over another site&#39;s ratings.
</p><p>
<b>eA:</b> So how do we trust these ratings across sites?
</p><p>
<b>DC:</b> We have to trust eBay that it trusts gBay. This is one
of the basics of distributed systems. In a monolithic system
you have a single trust domain: all parts can trust each other.
</p><p>
Split the application up across multiple trust domains and you need
authentication and crypto.  You can&#39;t get way from needing peer trust
structures built up explicitly through crypto, agreement and
contract and/or implicitly through past successful experience.
</p><p>
<b>eA:</b> Can you be more specific?
</p><p>
<b>DC:</b> Normally, a GET for a resource or a POST of some data comes
with a header identifying the GETer or POSTer. The resource can also
be signed by a user on a site or by the site itself as a proxy. 
</p><p>
Or, if you have an agreement with the site, you just need to use
https to ensure you&#39;ve got a secure connection with that site, 
then needn&#39;t have individual signatures.
</p><p>
<b>eA:</b> Where&#39;s the Single Sign On and Identity in all this?
We&#39;ve got users working across multiple sites.
</p><p>
<b>DC:</b> Well, gBay is the holder of the Gordon identity or persona -
and it manages his world view. Gordon on gBay needs his identity to
mean something on eBay, but we don&#39;t want him to have to create an
account on eBay or to have to tell gBay his eBay login details to
work on both sites. So he expects gBay and eBay to have come to
some agreements about technology and policy.
</p><p>
In REST, we don&#39;t have sessions and logins - we have identity,
which implies asymmetric (private/public key) crypto for signatures
and security. We have a number of tools available to us, including
OpenID and https, as well as resource signing.
</p><p>
<b>eA:</b> Here&#39;s a question for you: how would you manage a single
shopping trolley for Gordon on gBay, containing and allowing payment
for eBay goods?
</p><p>
<b>DC:</b> ShoppingTrolley resource, links to eBay and gBay items.  At
checkout, smaller eBay-Items-only ShoppingTrolley resource POSTed to
eBay along with CreditCard resource (again, you can sign the
ShoppingTrolley and encrypt the data).
</p><p>
<b>eA:</b> So, as eBay, why should we integrate the seller ratings of
someone on gBay? Or get gBay&#39;s for-sale items coming up in our
searches? Or accept Offers and ShoppingTrolleys from gBay? We don&#39;t
control or trust them, and don&#39;t want to send traffic or business
over to them.
</p><p>
<b>DC:</b> Fair enough, for now. I&#39;m only describing what&#39;s technically
possible. Like I said before, you may revisit your stance on
interoperability and mutual agreements one day soon. 
</p><p>
Also, what if your business decides this year to set up a commercial
partnership with another similar business and the managers come to
you asking how it&#39;s all going to work together internally?
</p><p>
You&#39;ll find having good REST interoperability already in place a
huge asset for internal integration! You&#39;ll also find that an
interop-friendly approach makes developing internal &#39;mashups&#39; much
easier.
</p><p>&#160;</p><p>
</p><p>
<b>Better Than SOA</b>
</p><p>
<b>eA:</b> I still can&#39;t see why all this is better than our SOAP
approach, though: it just seems like the same things are
happening at the end of the day - that it&#39;s only a change of 
perspective.
</p><p>
<b>DC:</b> Well, a minute ago, you were challenging using REST for
anything other than simple data manipulation. Now I&#39;ve shown 
you the power of a REST approach can be easily extended to a
clean, simple, scalable, interoperable, general, declarative
programming model. And you&#39;re still not satisfied!
</p><p>
<b>eA:</b> Ha! OK. So tell me why this programming model is so
scalable and interoperable compared with the SOAP API and 
normal function calls.
</p><p>
<b>DC:</b> It&#39;s scalable because of all the reasons I mentioned
before: the cacheability of the basic data operations and their
parallelisability through URI partitioning.  <i>updated - I meant 
data partitions not operation partitions!</i>
</p><p>
Plus now we have parallelisability of the application of the
business rules. There&#39;s nothing more parallelisable than a
declarative system.
</p><p>
<b>eA:</b> If you say so! OK, perhaps you could elaborate on that;
it sounds like a new point.
</p><p>
<b>DC:</b> It is: when you&#39;re leading the computer step-by-step
through a process, you have to handle concurrency yourself.
That&#39;s the &#39;How&#39; of &#39;What not How&#39;. 
</p><p>
Conversely, when you simply declare &#39;What&#39; the rules are, the
computer is free to go off and do things as concurrently as the
rules and the data separation allow.
</p><p>
<b>eA:</b> Mm. OK. Interoperability?
</p><p>
<b>DC:</b> It&#39;s interoperable again for the reasons I mentioned
before. Firstly, the power of the URI; this scenario is a full
player in the Web: you can share links to Items around and go
fetch your Offers and Feedbacks with a simple HTTP GET. You can
make things happen by POSTing to the relevant URI, given its
content type.
</p><p>
There&#39;s also the expectation of standard Content-Types,
sub-types and schemas in GET and POST, rather than custom
eBay WSDLs and schemas, that I mentioned before. 
</p><p>
<b>eA:</b> Like you said, you already mentioned these things.
Anything to add now that we&#39;re doing business rules?
</p><p>
<b>DC:</b> Yes; when data is your interface and resource
transformation your basic programming model, resource data
types become part of your &#39;programming language&#39;.  As such,
there is great benefit in sharing data types to <i>allow such
programming across multiple domain boundaries</i>. 
</p><p>
SOA, on the other hand, encourages inventing your own
&#39;programming language&#39; every time. It&#39;s a much more brittle
model and mind-set.
</p><p>
You can&#39;t GET your RespondToBestOffer function call, but I
can GET the ResponseToBestOffer!  It&#39;s basically a more
mashable approach to distributed programming.
</p><p>
<i>(c) 2006-2007 Duncan Cragg</i>
</p><p>&#160;</p><p>
In Part 5: <a href="http://duncan-cragg.org/blog/post/distributed-observer-pattern-rest-dialogues/">The Distributed Observer Pattern</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/imperative-declarative-inversion-open-data-ok/</id>
        <title>The &quot;Imperative to Declarative Inversion&quot;: Open Data is OK!</title>
        <published>2006-05-11T21:36:00Z</published>
        
        <updated>2006-05-11T21:36:00Z</updated>
        
        <link rel="alternate" type="text/html" href="http://duncan-cragg.org/blog/post/imperative-declarative-inversion-open-data-ok/" title="The &quot;Imperative to Declarative Inversion&quot;: Open Data is OK!" />
        
        <category term="copyright" />
        
        <category term="architecture" />
        
        <category term="declarative" />
        
        <category term="publishsubscribe" />
        
        <category term="p2p" />
        
        <category term="rest" />
        
        <summary type="xhtml">
            <div xmlns="http://www.w3.org/1999/xhtml">

<p>

There is something about the Internet that nurtures open data,
and something about computers that nurtures closed. It is 
often necessary, but often painful, to make the jump from local,
closed data to global, open data.
 &#160; ...
</p>

            </div>
        </summary>
        <content type="xhtml" xml:space="preserve">
            <div xmlns="http://www.w3.org/1999/xhtml">

<p>
</p><div class="summary"><p>
There is something about the Internet that nurtures open data,
and something about computers that nurtures closed. It is 
often necessary, but often painful, to make the jump from local,
closed data to global, open data.
</p></div><p>
The Internet is all about data; open data and open data formats
in particular. HTML, the fabric of the Web, links up vast
amounts of open data created in an open data format. Email is
sent either in the same HTML or (the most open of formats)
simple text.  Feed publishing shows that opening data can
become an unstoppable flow. Indeed, Peer-to-Peer technology
shows that opening data can become a torrent...
</p><p>
However, on our computers, data is often much less free. Take a
closed format such as Microsoft Word: such a document can only
properly be unlocked after paying for Microsoft Office.  Take
copyright data under DRM (Digital Restrictions Management):
such music, etc., has to be unlocked by paying for the key.
</p><p>
Even with nominally open formats, there&#39;s a tendency to tie one
format to one application. You still need that application to
unlock the data.  And even object-oriented programmers follow
the closed data rule: data must be wrapped in a class interface. 
</p><p>
Application user interfaces, class interfaces and service
interfaces whose implementation processes mediate, control and
restrict data and their formats are the bread-and-butter of the
non-Internet computer domain.  They work best on the more
tightly-controllable computer hosts.
</p><p>&#160;</p><p>
<b>They Just Don&#39;t Mix</b>
</p><p>
But the processes and the people that like to control data
don&#39;t mix too well with the Internet. Here are some examples
of the incongruity (or outright clash) that can result:
</p><p>
</p><ul>
<li>It still jars to hit a link and find, not something that the browser can handle - not an open format resource - but a PDF or a Word document. And, of course, you need to have paid for Office or to have installed Acrobat to see it.</li>
<li>Google dips in to these Word documents and PDFs, presumably legally, but in theory this right could be revoked at any time.</li>
<li>Some Web site owners get upset about people indexing or linking into resources on their site (&#39;deep linking&#39;).</li>
<li>Web caches, including the Google cache, are in potential breach of copyright by copying data.</li>
<li>The music and film industries have witnessed the power of Peer-to-Peer to shake up their world of controllable data.</li>
<li>Taking the computer concept of &#39;interface and process&#39; and translating it literally to the Internet - RPC and RMI - has yet to achieve the success promised; although the vendors of SOA and WS-* still believe it&#39;s possible.</li>
</ul><p>
Now, these processes and people that like to control data
obviously can&#39;t just avoid the Internet. So they&#39;d be better
off embracing the open data philosophy if they&#39;re going to do
things here.
</p><p>
Embracing open data can take courage and open-mindedness.  It
means letting go of proprietary lock-in, copyright obsession,
RPC, RMI and Service-Oriented Architectures. The lock-step
imperative, procedural, workflow and object-oriented programming
that works locally doesn&#39;t translate well onto the &#39;Net.  The
rules change.
</p><p>&#160;</p><p>
<b>Open Data Can Work</b>
</p><p>
In fact, it is possible to make a living in this
wild frontier, even when everyone can see, understand and copy
your data! (For example, watch this blog for ways to make
money on the Internet even when unlimited copying is allowed,
based on originality or novelty backed up by a little crypto
technology!)
</p><p>
I call the flip from closed data to open data the &#39;Imperative to 
Declarative Inversion&#39;. It&#39;s the flip from &#39;How&#39; to &#39;What&#39; - from 
process-centric to data-centric programming.
</p><p>
In this upside-down world of What not How, <i>the data format and
its update formats are the public &#39;interface&#39;, and process
animates things behind the scenes</i>.  Reading about REST will
provide an excellent grounding in this way of thinking.
</p><p>
Showing the benefits of inverting (scalability, robustness,
interoperability, value for money, speed and flexibility of
development) and helping overcome the understandable fears of
inverting are the main goals of this blog. In fact, I will also
show how the Declarative approach works pretty well off-Net
too - in the domain traditionally owned by process... 

</p>

            </div>
        </content>
    </entry>
    
    <entry>
        <id>http://duncan-cragg.org/blog/post/welcome-to-what-not-how/</id>
        <title>Welcome to &#39;What Not How&#39;</title>
        <published>2006-03-22T17:00:48Z</published>
        
        <updated>2006-03-22T17:00:48Z</updated>
        
        <link rel="alternate" type="text/html" href="http://duncan-cragg.org/blog/post/welcome-to-what-not-how/" title="Welcome to &#39;What Not How&#39;" />
        
        <category term="semanticweb" />
        
        <category term="architecture" />
        
        <category term="declarative" />
        
        <category term="web2.0" />
        
        <category term="socialsoftware" />
        
        <category term="p2p" />
        
        <category term="event-driven" />
        
        <category term="rest" />
        
        <summary type="xhtml">
            <div xmlns="http://www.w3.org/1999/xhtml">

<p>

Declarative Architectures focus on the What, not the How, of programming.  The How has dominated the field - perhaps 80% of programming is done in the traditional Imperative style, where we tell the computer How to do a task in explicit steps.
</p><p>
I&#39;d like to show in this blog how Declarative Architectures and technologies are not just an interesting sideshow to the main Imperative attraction, but a complete and powerful programming alternative in their own right - indeed, one which has already dominated certain fields.  
</p><p>
Imagine being able to simply express What we want the computer to do - to give it constraints and rules - then let it work out for itself How to achieve our goals.
</p><p>
I believe that saying What, not How, will become the dominant paradigm in programming.
 &#160; ...
</p>

            </div>
        </summary>
        <content type="xhtml" xml:space="preserve">
            <div xmlns="http://www.w3.org/1999/xhtml">

<p>
</p><div class="summary"><p>
Declarative Architectures focus on the What, not the How, of programming.  The How has dominated the field - perhaps 80% of programming is done in the traditional Imperative style, where we tell the computer How to do a task in explicit steps.
</p><p>
I&#39;d like to show in this blog how Declarative Architectures and technologies are not just an interesting sideshow to the main Imperative attraction, but a complete and powerful programming alternative in their own right - indeed, one which has already dominated certain fields.  
</p><p>
Imagine being able to simply express What we want the computer to do - to give it constraints and rules - then let it work out for itself How to achieve our goals.
</p><p>
I believe that saying What, not How, will become the dominant paradigm in programming.
</p></div><p>
</p><p>
<b>What?</b>
</p><p>
Declarative Architectures are about data: documents, assertions, truths, rules, tables, structures, state, bits. Data storage, changes, constraints, transformation, sharing, querying, fetching, interaction, presentation, subscription, tagging.  
</p><p>
In summary, we talk about stuff, changes to stuff and rules governing stuff. Not processes, actions, jobs or functions.
</p><p>
It&#39;s amazing how many interesting Declarative technologies are actually out there already - especially given that most programming is Imperative.  They tend to go unnoticed; subservient to their Imperative masters.
</p><p>
Here are some examples from our daily work life (assuming you work in computing!):
</p><ul>
<li>    XML: XSL, XPath, XQuery, Schematron, RelaxNG, Xcerpt, XForms, XRules</li>
<li>    Other MLs: XUL, XForms, XAML, YAML, ...</li>
<li>    Relational DBs, SQL</li>
<li>    Publish / Subscribe: &#39;this has changed&#39;, not &#39;do this&#39;</li>
<li>    Observer Pattern, MVC (maybe)</li>
<li>    EII: architectures for business data and events &#39;landscapes&#39;</li>
<li>    JCache, SpiritCache: updateable, cascadable caches, &#39;active queries&#39;</li>
<li>    Business Rule programming</li>
<li>    Spreadsheets</li>
<li>    JNDI</li>
<li>    Makefiles, Ant; Source Control: versioning, deltas</li>
</ul><p>
What all these have in common is that they are purely data- and event-driven or oriented. Not a thread in sight (if used properly). No method calls. Just querying, fetching, subscribing, tagging, declaring truths and rules, making changes to stuff, etc.
</p><p>
On the &#39;Net, all the dominant technologies are actually Declarative, not Imperative:
</p><ul>
<li>    DNS</li>
<li>    REST: URIs, HTTP</li>
<li>    Mail, News: SMTP, NNTP</li>
<li>    Instant Messaging; VoIP</li>
<li>    P2P: BitTorrent, Gnutella</li>
<li>    Multimedia: streaming, multicasting, PeerCast</li>
<li>    Compression, Information Theory, Cryptography, Trust</li>
</ul><p>
Again, the same things are happening: querying, fetching, subscribing, tagging, declaring truths and rules, making changes to stuff. 
</p><p>
Email (SMTP) is a great example of a Declarative Architecture, with its routing and transformation rules and self-addressed store-and-forward transmission. And, in fact, much the same applies to the rest of this list, where the Declarative aspects may include network querying and data events.  
</p><p>
Imperative protocols such as RPC, RMI, CORBA, SOAP, etc. haven&#39;t had anywhere near the impact of their Declarative cousins.
</p><p>
Now, consider the &#39;Web 2.0&#39; technologies:
</p><ul>
<li>    HTTP/1.1, XHTML</li>
<li>    Metadata: RSS, RDF, Atom, MicroFormats, tagging engines</li>
<li>    REST Web APIs for XML metadata (including RSS/Atom)</li>
<li>    DHTML; AJAX (when used as DOM updater), mod_pubsub</li>
<li>    Identity; Single Sign-On Web-APIs: OpenID</li>
</ul><p>
This is a wonderful list of Declarative approaches (as long as we use REST APIs and talk about Resources, not SOAP ones talking about functions and jobs!).
</p><p>
So far, I&#39;ve mentioned technologies that have attached themselves to the periphery of Imperative programming, where the actual behaviour is still driven procedurally, or How-like. 
</p><p>
However, Declarative programming itself has a history at least as long as Imperative programming,
and includes:
</p><ul>
<li>    Lisp, Rewriting systems</li>
<li>    Prolog, Deductive Databases, The Semantic Web</li>
<li>    Rule-Driven systems, Knowledge Engineering, Cyc, Ontologies</li>
<li>    Tuple Spaces, Javaspaces</li>
<li>    Neural Networks, Genetic Algorithms, Cellular Automata</li>
<li>    Example-based programming: Subtext</li>
</ul><p>
We can, if we choose, write 100% Declarative systems (even down to asynchronous or event-driven operating systems and hardware).
</p><p>&#160;</p><p>
<b>Wherefore?</b>
</p><p>
In this blog, I&#39;ll be pointing out opportunities where we can benefit from the Declarative approach when it&#39;s ready. 
</p><p>
Perhaps the biggest example of a Declarative Architecture that is ready to benefit us now is the Web.  In contrast, the Imperative Service-Oriented Architecture model and so-called &#39;Web&#39; Services are still weaning; still trying to get a life free of their huge standards consortia. REST, in its simplicity, ubiquity and straightforward usefulness is orders of magnitude more deployed than SOAP will likely ever be.
</p><p>
This blog is for discussing the common problems and solutions in Declarative technologies; seeing if ideas in one area can be used in another and seeing if we can distill their lessons and their approaches.  
</p><p>
Ultimately, heading towards a unified, distributed Declarative programming technology landscape. 
</p><p>
I hope you&#39;ll join me in my explorations into Declarative Architectures, in particular if you&#39;re interested in the currently most promising segment I mentioned: Web 2.0, and its application in Social Software. 
</p><p>
Or the currently massive but little-mentioned segment: Peer-to-Peer, and its application to the disruption of, well you know, all those big technological and commercial hierarchies...
</p><p>

</p>

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

