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

<channel>
	<title>iansrobinson.com &#187; Consumer-Driven Contracts</title>
	<atom:link href="http://iansrobinson.com/category/consumer-driven-contracts/feed/" rel="self" type="application/rss+xml" />
	<link>http://iansrobinson.com</link>
	<description>Ian Robinson&#039;s Blog</description>
	<lastBuildDate>Thu, 02 Sep 2010 14:22:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Europe Virtual ALT.NET, July 20th</title>
		<link>http://iansrobinson.com/2009/07/18/europe-virtual-alt-net-july-20th/</link>
		<comments>http://iansrobinson.com/2009/07/18/europe-virtual-alt-net-july-20th/#comments</comments>
		<pubDate>Sat, 18 Jul 2009 14:50:54 +0000</pubDate>
		<dc:creator>iansrobinson</dc:creator>
				<category><![CDATA[Consumer-Driven Contracts]]></category>
		<category><![CDATA[Events]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[SOA]]></category>

		<guid isPermaLink="false">http://iansrobinson.com/?p=129</guid>
		<description><![CDATA[On Monday 20th July, Jim Webber and I, the golem and the frog, will be participating in the European Virtual ALT.NET (E-VAN). Colin Jack has already assembled a bunch of interesting questions, covering not only REST, but Guerrilla SOA, ESBs, consumer-driven contracts, and capability modeling. 

The session will be on Live Meeting, at http://snipr.com/virtualaltnet.

Please join [...]]]></description>
			<content:encoded><![CDATA[<p>On Monday 20th July, <a href="http://jim.webber.name/" title="Jim Webber's blog" target="_blank">Jim Webber</a> and I, the <a href="http://www.infoq.com/interviews/robinson-webber-rest" title="Ian Robinson and Jim Webber on Web-based Integration" target="_blank">golem and the frog</a>, will be participating in the European Virtual ALT.NET (E-VAN). <a href="http://colinjack.blogspot.com/" title="Colin Jack's blog" target="_blank">Colin Jack</a> has already assembled a bunch of <a href="http://groups.google.com/group/virtualaltnet/browse_thread/thread/b3efba445f6ff2eb?hl=en" title="Questions for Jim and Ian" target="_blank">interesting questions</a>, covering not only REST, but Guerrilla SOA, ESBs, consumer-driven contracts, and capability modeling.</p> 

<p>The session will be on Live Meeting, at <a href="http://snipr.com/virtualaltnet" title="Europe Virtual ALT.NET Live Meeting" target="_blank">http://snipr.com/virtualaltnet</a>.</p>

<p>Please join us on Monday, times below:</p>

<ul>
<li>France/Germany/Belgium: 8:00PM</li>
<li>UK is: 7:00PM</li>
<li>EST in the US: 2:00PM</li>
<li>PST in the US: 11:00AM</li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://iansrobinson.com/2009/07/18/europe-virtual-alt-net-july-20th/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Service-Oriented Development with Consumer-Driven Contracts</title>
		<link>http://iansrobinson.com/2008/07/28/service-oriented-development-with-consumer-driven-contracts/</link>
		<comments>http://iansrobinson.com/2008/07/28/service-oriented-development-with-consumer-driven-contracts/#comments</comments>
		<pubDate>Mon, 28 Jul 2008 15:40:15 +0000</pubDate>
		<dc:creator>iansrobinson</dc:creator>
				<category><![CDATA[Behaviour-Driven Development]]></category>
		<category><![CDATA[Consumer-Driven Contracts]]></category>

		<guid isPermaLink="false">http://iansrobinson.com/?p=18</guid>
		<description><![CDATA[A few months ago Stefan Tilkov very kindly offered me the opportunity to write about consumer-driven contracts for InfoQ. The resulting article, &#8220;Service-Oriented Development with Consumer-Driven Contracts&#8221; is now available online.
Special thanks to Stefan for thoroughly reviewing a draft of the article, Dan North for helping shape an even earlier version, and Jim Webber and [...]]]></description>
			<content:encoded><![CDATA[<p>A few months ago <a href="http://www.innoq.com/blog/st/" title="Stefan Tilkov's blog" target="_blank">Stefan Tilkov</a> very kindly offered me the opportunity to write about consumer-driven contracts for <a href="http://www.infoq.com/" title="InfoQ" target="_blank">InfoQ</a>. The resulting article, <a href="http://www.infoq.com/articles/consumer-driven-contracts" title="Service-Oriented Development with Consumer-Driven Contracts" target="_blank">&#8220;Service-Oriented Development with Consumer-Driven Contracts&#8221;</a> is now available online.</p>
<p>Special thanks to Stefan for thoroughly reviewing a draft of the article, <a href="http://dannorth.net/" title="Dan North's blog" target="_blank">Dan North</a> for helping shape an even earlier version, and <a href="http://jim.webber.name/" title="Jim Webber's blog" target="_blank">Jim Webber</a> and <a href="http://iancartwright.com/blog/" title="Ian Cartwright's blog" target="_blank">Ian Cartwright</a> for lots of conversation and encouragement.</p>
<p>I&#8217;ve still not written much on how to implement consumer-driven contracts, but I&#8217;ve something special cooking (slowly) in that area: expect some illustrative material to emerge over the next few months.</p>
]]></content:encoded>
			<wfw:commentRss>http://iansrobinson.com/2008/07/28/service-oriented-development-with-consumer-driven-contracts/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Stories, Capabilities, Services and Contracts</title>
		<link>http://iansrobinson.com/2008/06/25/stories-capabilities-services-contracts/</link>
		<comments>http://iansrobinson.com/2008/06/25/stories-capabilities-services-contracts/#comments</comments>
		<pubDate>Wed, 25 Jun 2008 20:48:21 +0000</pubDate>
		<dc:creator>iansrobinson</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Behaviour-Driven Development]]></category>
		<category><![CDATA[Consumer-Driven Contracts]]></category>
		<category><![CDATA[SOA]]></category>

		<guid isPermaLink="false">http://iansrobinson.com/?p=16</guid>
		<description><![CDATA[Today I want to introduce a bare-bones model to help guide the creation of business, architectural and technology artefacts in an agile and iterative manner over the course of an SOA initiative:

	Stories – in the form of Behaviour-Driven Development exemplars – describe goals and desired outcomes;
	Capabilities encapsulate the resources and abilities an organisation needs to [...]]]></description>
			<content:encoded><![CDATA[<p>Today I want to introduce a bare-bones model to help guide the creation of business, architectural and technology artefacts in an agile and iterative manner over the course of an SOA initiative:</p>
<ul>
	<li>Stories – in the form of <a href="http://en.wikipedia.org/wiki/Behavior_driven_development" title="Behaviour-Driven Development" target="_blank">Behaviour-Driven Development</a> <em>exemplars</em> – describe goals and desired outcomes;</li>
	<li><a href="http://msdn.microsoft.com/en-us/arcjournal/bb245662.aspx" title="Service-Oriented Modeling for Connected Systems: Part 1" target="_blank">Capabilities</a> encapsulate the resources and abilities an organisation needs to satisfy those goals;</li>
	<li>Services host capabilities;</li>
	<li>Contracts – particularly <a href="http://martinfowler.com/articles/consumerDrivenContracts.html" title="Consumer-Driven Contracts" target="_blank">consumer-driven contracts</a> – assert the interactions between services.</li>
</ul>
<p>We iterate over this model many times in the course of an engagement, emphasising different parts as we go. We concentrate on organisation-level stories and capabilities when establishing an organisation-wide context, then project-level stories, capabilities and services whilst planning projects and delivery streams, and then release- and iteration-level artefacts during specific instances of delivery.</p>
<p>Such an approach represents a &#8220;thin-slice&#8221; way to:</p>
<ul>
	<li>establish context, business goals and consensus amongst stakeholders;</li>
	<li>create a long-term vision that joins up the business, architectural and technology views of an SOA initiative;</li>
	<li>describe and challenge an organisation’s goals and the benefits attached to those goals;</li>
	<li>describe the capabilities needed to meet those goals;</li>
	<li>identify the quality-of-service expectations the business has of those capabilities;</li>
	<li>identify services and assign capabilities to services;</li>
	<li>describe and test the externally visible interactions between services;</li>
	<li>identify, plan and develop slices of service functionality that deliver business benefits early and often.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://iansrobinson.com/2008/06/25/stories-capabilities-services-contracts/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>In Conversation</title>
		<link>http://iansrobinson.com/2008/04/24/in-conversation/</link>
		<comments>http://iansrobinson.com/2008/04/24/in-conversation/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 14:10:40 +0000</pubDate>
		<dc:creator>iansrobinson</dc:creator>
				<category><![CDATA[Consumer-Driven Contracts]]></category>

		<guid isPermaLink="false">http://iansrobinson.com/?p=10</guid>
		<description><![CDATA[You&#8217;d be forgiven for thinking I&#8217;ve got nothing else to talk about&#8230;

In preparation for the launch of the ThoughtWorks Anthology, each of the authors recorded a short podcast in which they discuss their essay. Mine is online now. It&#8217;s four minutes tops &#8211; the perfect aural companion as you huddle outside with a cigarette.

If you [...]]]></description>
			<content:encoded><![CDATA[<p>You&#8217;d be forgiven for thinking I&#8217;ve got nothing else to talk about&#8230;</p>

<p>In preparation for the launch of the <a href="http://www.pragprog.com/titles/twa/thoughtworks-anthology" title="ThoughtWorks Anthology" target="_blank"><em>ThoughtWorks Anthology</em></a>, each of the authors recorded a short podcast in which they discuss their essay. Mine is <a href="http://www.thoughtworks.com/what-we-say/" title="On The Line: Interviews with Contributors to The ThoughtWorks Anthology" target="_blank">online</a> now. It&#8217;s four minutes tops &#8211; the perfect aural companion as you huddle outside with a cigarette.</p>

<p>If you like that, you might like this: a couple of years ago, Martin Fowler and I did an interview with Microsoft&#8217;s Ron Jacobs on the <a href="http://channel9.msdn.com/Podcasts/185279_ARCast04202006-TheEvolutionOfArchitectureWithMartinFowler.mp3" title="ARCast - The Evolution of Architecture with Martin Fowler" target="_blank"><em>Evolution of Architecture</em></a>. As per usual, I&#8217;m a one-note band&#8230;</p>]]></content:encoded>
			<wfw:commentRss>http://iansrobinson.com/2008/04/24/in-conversation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://channel9.msdn.com/Podcasts/185279_ARCast04202006-TheEvolutionOfArchitectureWithMartinFowler.mp3" length="11614336" type="audio/mpeg" />
		</item>
		<item>
		<title>A Contract Vocabulary: Part 3</title>
		<link>http://iansrobinson.com/2008/04/20/a-contract-vocabulary-part-3/</link>
		<comments>http://iansrobinson.com/2008/04/20/a-contract-vocabulary-part-3/#comments</comments>
		<pubDate>Sun, 20 Apr 2008 19:35:44 +0000</pubDate>
		<dc:creator>iansrobinson</dc:creator>
				<category><![CDATA[Consumer-Driven Contracts]]></category>

		<guid isPermaLink="false">http://iansrobinson.com/?p=9</guid>
		<description><![CDATA[This is the last of a three-part series of posts discussing the contract vocabulary aspects of my article Consumer-Driven Contracts. The other posts are here:


	A Contract Vocabulary: Part 1
	A Contract Vocabulary: Part 2


In this post I’m going to address a few questions and puzzles:


	Does Consumer-Driven Contracts really achieve a separation of concerns?
	Are consumer-driven contracts applicable [...]]]></description>
			<content:encoded><![CDATA[<p>This is the last of a three-part series of posts discussing the contract vocabulary aspects of my article <a href="http://martinfowler.com/articles/consumerDrivenContracts.html" title="Consumer-Driven Contracts" target="_blank"><em>Consumer-Driven Contracts</em></a>. The other posts are here:</p>

<ul>
	<li><a href="http://iansrobinson.com/2008/03/27/a-contract-vocabulary-part-1/" title="A Contract Vocabulary: Part 1" target="_blank">A Contract Vocabulary: Part 1</a></li>
	<li><a href="http://iansrobinson.com/2008/04/01/a-contract-vocabulary-part-2/" title="A Contract Vocabulary: Part 2" target="_blank">A Contract Vocabulary: Part 2</a></li>
</ul>

<p>In this post I’m going to address a few questions and puzzles:</p>

<ul>
	<li>Does <em>Consumer-Driven Contracts</em> really achieve a separation of concerns?</li>
	<li>Are consumer-driven contracts applicable only in point-to-point scenarios?</li>
	<li>Never mind the theory, is all this feasible in practice?</li>
</ul>

<h3>A Separation of Concerns?</h3>

<p>Is the triumvirate of provider, consumer and consumer-driven contracts a true separation of concerns? The goal of any separation of concerns is to <a href="http://en.wikipedia.org/wiki/Separation_of_concerns" title="WikiPedia definition of Separation of Concerns" target="_blank">allow functions [to] be optimized independently of other functions</a>. Mark Baker suggests that we will have successfully separated concerns if <a href="http://www.infoq.com/articles/separation-of-concerns" title="The Lost Art of Separating Concerns" target="_blank">variations in [concern] A do not induce or require a corresponding change in [concern] B (and usually, the converse)</a>. Do our three contracts pass this test?</p>

<p>By distinguishing between provider and consumer contracts we make explicit the fact that one half of the provider-consumer relationship ought to be able to change without inducing a corresponding change in the other half – <em>within limits</em>. Providers ought to be able to evolve their contracts without obliging their consumers to change – <em>just so long as they continue to satisfy existing obligations</em>. Consumers ought to be able to modify their consumption of a provider’s existing services without requiring either that their peers change or that the provider itself be updated – <em>up to the point they require new functionality of the service provider</em>.</p>

<p>These limit cases suggest that our concerns here are not so much separated as <em>separating</em>. What prevents an absolute separation is the very thing that constitutes some measure of success for any distributed system: good services are used, and in being used, become a “victim” of their own success. These limits to the separation of concerns are surfaced as a third type of contract: the consumer-driven contract. Such contracts measure the success of a service, insofar as they catalogue its obligations, whilst at the same time describing when and where a variation in concern A (the provider contract) will induce a change in concern B (one or more consumer contracts).</p>

<h3>Service Indirection</h3>

<p>Another question I sometimes get asked is: aren’t your three contracts really only applicable in point-to-point scenarios, where consumers communicate directly with a service provider?</p>

<p>It’s important here to distinguish between the accountability of a service and its location. As a consumer of services, I tend to want to delegate my business to providers I trust, even if I don’t quite know where the specific person, department or office dealing with my request is located. Accountability in this instance is really shorthand for my ability to determine whether a provider is capable of satisfying my functional and quality-of-service requirements, and thereafter to demand traceability of it in respect of any requests I make. I’d be foolish to delegate my interests to some anonymous party I know nothing about, and from whom I can’t secure a guarantee of accountability, which is why I tend to draw back from an SOA-ad-absurdum that encourages me to fling messages into the “cloud,” to be satisfied by “something,” “somewhere.”</p>

<p>The key point here is that consumer-driven contracts require a site of responsibility or accountability. Mediated, brokered and routed messaging scenarios are perfectly amenable to consumer-driven contracts just so long as they don’t diminish service responsibility. It may be that I delegate some of my due diligence activities to a broker, which then matches my requirements against trusted providers; but even here, where I don’t know who exactly is satisfying my requests, I have a trust relationship, an expectation-obligation relationship, with at least one party – the broker – and therefore a potential site for consumer-driven contracts.</p>

<h3>Theory into Practice</h3>

<p>I ended my last post with the suggestion that in many cases it’s useful for a service provider to know something of its consumer-driven contract. Assuming you do want to know more about a provider’s current contractual obligations, we then need to ask: can you in fact discover what those obligations are? Can you identify a service’s consumers?</p> 

<p>The answers to these questions will vary according to the environment in which a service provider is situated. In an enterprise environment, one in which the landscape is well known, it is often possible to identify all consumers of a service. Outside the enterprise, things may be more difficult. Services on the Web, for example, may have a largely anonymous clientele, making it near impossible to discover “existing” contractual obligations.</p>

<p>That’s not the end of the problem. Even if you can identify a consumer, it may still prove difficult to establish whether a relationship between that consumer and the provider is in fact currently in force. Whilst many such relationships are long-lived, particularly in the enterprise (I’m not talking about long-lived instances of a connection or transaction, merely the fact that for some period of time we can confidently say that service X is likely to collaborate or have some relation with service Y to satisfy such-and-such a business process), others are more ad hoc and less easily identified – a function of an agent crawling a service inventory, perhaps. In these circumstances, a snapshot of contractual obligations, even if some such thing could be generated, may well have some fuzzy edges.</p>

<p>The twin issues of the liveness and lifetimes of consumer-driven contracts and the consumer contracts from which they are derived are of renewed interest to me today. When does a consumer-driven contract begin? When does it end? When does it change?</p>

<p>I’ve no doubt that all three kinds of contract – provider, consumer and consumer-driven – are more or less in play in every distributed interaction, irrespective of the architectural and implementation decisions that have helped shape that interaction. But it’s clear to me now that the separation of concerns described in my original article was influenced heavily by the relatively static nature of the Web Services stack’s contract mechanism. WSDL is an upfront (partial) declaration of a provider contract. Clients activate an application protocol – engage in a conversation with a service – by invoking the operations that have been published in the WSDL (the protocol’s not inherent in the contract, only the levers by which it can be activated). By contrast, more RESTful services allow for a certain dynamism in the conversational aspects of a provider contract: representations in and of themselves advertise the levers by which a client can advance the application protocol, and they do this without reference to some pre-existing static contract map. Provider contracts in such services are “for the now,” and are exhausted in being consumed.</p>

<p>How do the forces at play in a RESTful interaction affect our understanding of consumer-driven contracts? If they make it more difficult to describe consumer relations outside of a specific instance of an interaction, do they not also make it correspondingly less important to know something of the consumer relation? My thinking is not settled on these issues. Sometimes I’m inclined to think of a consumer-driven contract as a resource, as a <a href="http://www-db.cs.wisc.edu/cidr/cidr2007/papers/cidr07p36.pdf" title="Isolation Support for Service-based Applications" target="_blank">promise</a> to provide such-and-such, to be provisioned by the provider for a certain period of time; at other times I prefer to see it as a function of per-request content negotiation. More on this another time.</p>

<h3>Summary</h3>

<p>In summary, <em>Consumer-Driven Contracts</em> describes in some detail the forces in play in any loosely coupled relationship. It does this by proposing that three types of contract exist between service providers and consumers. Real-world implementations of distributed systems exhibit all three types of contract, but the degree to which we can describe each contract, and the need to do so, varies according to the context.</p>
]]></content:encoded>
			<wfw:commentRss>http://iansrobinson.com/2008/04/20/a-contract-vocabulary-part-3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A Contract Vocabulary: Part 2</title>
		<link>http://iansrobinson.com/2008/04/01/a-contract-vocabulary-part-2/</link>
		<comments>http://iansrobinson.com/2008/04/01/a-contract-vocabulary-part-2/#comments</comments>
		<pubDate>Tue, 01 Apr 2008 12:31:26 +0000</pubDate>
		<dc:creator>iansrobinson</dc:creator>
				<category><![CDATA[Consumer-Driven Contracts]]></category>

		<guid isPermaLink="false">http://iansrobinson.com/2008/04/01/a-contract-vocabulary-part-2/</guid>
		<description><![CDATA[In my last post I described Consumer-Driven Contracts as an attempt at a contract vocabulary with three core terms: provider contracts, consumer contracts and consumer-driven contracts. In this post I&#8217;ll flesh out each of those terms.
Provider Contracts
These are the contracts with which many of us imbued with service-oriented concepts will be most familiar. They&#8217;re the [...]]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://iansrobinson.com/2008/03/27/a-contract-vocabulary-part-1/" title="A Contract Vocabulary: Part 1" target="_blank">last post</a> I described <a href="http://martinfowler.com/articles/consumerDrivenContracts.html" title="Consumer-Driven Contracts" target="_blank"><em>Consumer-Driven Contracts</em></a> as an attempt at a contract vocabulary with three core terms: provider contracts, consumer contracts and consumer-driven contracts. In this post I&#8217;ll flesh out each of those terms.</p>
<h3>Provider Contracts</h3>
<p>These are the contracts with which many of us imbued with service-oriented concepts will be most familiar. They&#8217;re the contracts identified in that hoary old tenet, &#8220;Services share schemas and contracts, not classes and types.&#8221; Provider contracts mark services as king of their own domain &#8211; &#8220;this is what I am, what I offer, take it or leave it.&#8221; They&#8217;re the first-line defence in the struggle to preserve service autonomy. As I suggested in my previous post, in the WS-* world provider contracts typically comprise some or all of <a href="http://www.soaglossary.com/service_contract.asp" title="Thomas Erl's definition of Service Contract" target="_blank">WSDL plus XML Schema plus WS-Policy</a>.</p>
<h3>Consumer Contracts</h3>
<p>These kinds of contract are really a private affair, particular to a specific consumer &#8211; to the way in which that consumer uses a service. In short, a consumer contract is a description of the parts of the service in which the consumer is <em>really</em> interested, the parts upon which it <em>really</em> depends. These might be interfaces, parts of an interface, operations, schemas, parts of schemas, quality-of-service characteristics, etc.: all those things I cheerfully labelled &#8220;a logical set of exportable business function elements.&#8221; More often than not, these specific usage characteristics remain implicit, and can be gleaned only be diving into the implementation of the consumer.</p>

<p>Some consumers need everything a provider exports: schemas, operations, endpoints, policies, and so on. More often than not, however, a consumer really only needs a subset of what the provider offers. Some consumers import only what is absolutely necessary, and ignore or tolerate changes in all the rest, but others will import or bind to everything, irrespective of its usefulness. Binding to everything might be appropriate in some circumstances, but at other times it&#8217;s a real barrier to evolution.</p>

<p>Oddly enough, I get the feeling that when people refer to consumer-driven contracts, they&#8217;re actually talking about consumer contracts. Most of the practical work in the area of service evolution seeks to reduce the amount of knowledge a consumer must have of a provider, whether it&#8217;s knowledge of a provider&#8217;s implementation (almost always a bad idea), or knowledge of parts of a provider contract that really have no bearing on the consumer. After all, knowledge is a dependency, isn&#8217;t it? Reduce the consumer&#8217;s knowledge of the provider &#8211; limit the scope of the consumer contract &#8211; and so achieve just enough coupling, no more.</p>

<p>I suggest it&#8217;s useful for consumers to know what their consumer contracts are.</p>
<h3>Consumer-Driven Contracts</h3>
<p>In the original article I also called these <em>derived contracts</em>, but I don&#8217;t often use that term: &#8220;consumer-driven contracts&#8221; was suggested to me by Robin Shorrock, and I much prefer it &#8211; though if you&#8217;ve been test-, behaviour-, budget- and whatnot- driven to a frenzy, you might prefer &#8220;derived.&#8221;</p>

<p>Consumer-driven contracts bring the contractual forces back home to the provider. Assume for a moment that you could identify all the current consumers of your service; assume also that for each consumer you could know its consumer contract. A consumer-driven contract is the aggregate of all these consumer contracts. It&#8217;s a snapshot of existing contractual relations: it&#8217;s what the provider has to do to really satisfy existing dependencies, as opposed to what it started off offering. On the one hand, the provider offers a provider contract &#8211; &#8220;all that I am&#8221; &#8211; on the other, based on some set of current consumer expectations, it&#8217;s obliged to maintain only some portion of this contract. (Note that in some cases this &#8220;some portion&#8221; might in fact be everything that a provider offers under its provider contract, in which case its provider and consumer-driven contract look similar.)</p>

<p>Whilst we can say that a weak form of consumer-driven contract is implicit in all provider-consumer relations, <em>Consumer-Driven Contracts</em> took the idea a little further, suggesting that consumers might wish to import their consumer contracts into the provider, thereby surfacing an explicit consumer-driven contract.</p>

<p>Now the thorny question is: should you really seek to identify a provider&#8217;s &#8220;real&#8221; contractual obligations? After all, isn&#8217;t this extra knowledge, and isn&#8217;t extra knowledge an extra dependency, a tightening of the coupling screw?</p>

<p>My first response is to point out that these consumer expectations, and the provider&#8217;s obligation to satisfy them, exist whether we like it or not. Change something upon which a consumer currently depends, and you might very well break that consumer. Wouldn&#8217;t it be useful to know what you can and can&#8217;t change about a provider&#8217;s exported functionality, its provider contract, based on a &#8220;current&#8221; view of consumer relations? Wouldn&#8217;t this perhaps help you plan and govern the evolution of your service in response to changing business requirements?</p>

<p>I suggest that in many cases it&#8217;s useful for a provider to know what its consumer-driven contract is.</p>]]></content:encoded>
			<wfw:commentRss>http://iansrobinson.com/2008/04/01/a-contract-vocabulary-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Contract Vocabulary: Part 1</title>
		<link>http://iansrobinson.com/2008/03/27/a-contract-vocabulary-part-1/</link>
		<comments>http://iansrobinson.com/2008/03/27/a-contract-vocabulary-part-1/#comments</comments>
		<pubDate>Thu, 27 Mar 2008 13:33:23 +0000</pubDate>
		<dc:creator>iansrobinson</dc:creator>
				<category><![CDATA[Consumer-Driven Contracts]]></category>

		<guid isPermaLink="false">http://iansrobinson.com/2008/03/27/a-contract-vocabulary-part-1/</guid>
		<description><![CDATA[Consumer-Driven Contracts was first and foremost an attempt at a contract vocabulary – though you’d be forgiven for thinking otherwise: the vocabulary definitions are buried away in a wealth of implementation detail. The original article is based around a simple, XML-based example – that of evolving an Order message schema in response to the changing [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://martinfowler.com/articles/consumerDrivenContracts.html" title="Consumer-Driven Contracts" target="_blank"><em>Consumer-Driven Contracts</em></a> was first and foremost an attempt at a contract vocabulary – though you’d be forgiven for thinking otherwise: the vocabulary definitions are buried away in a wealth of implementation detail. The original article is based around a simple, XML-based example – that of evolving an <em>Order</em> message schema in response to the changing needs of both a service provider and its consumers. On top of that, I discuss the <em>Must Ignore</em> convention as it is applied in XML Schema, and the use of languages such as <a href="http://www.schematron.com/" title="Schematron" target="_blank">Schematron</a> to implement alternatives to XML Schema validation.</p>

<p>Looked at from the point of view of these details, the article appears to be nothing more that a summary of some reasonably well-known validation techniques as they apply to specific schema, validation and contract languages. But I’m not sure that’s all there is to it. For me, the core focus has always been on a simple separation of concerns. <em>Consumer-Driven Contracts</em> was motivated by a desire to unpack the term &#8220;loosely coupled;&#8221; to turn a spotlight on the several facets of the contractual relations between services, and to name each part. I wanted to create a vocabulary for describing the roles of the participants in a loosely coupled relationship, so that we might better understand who does what when a service changes, and so articulate the knotty problem of service evolution.</p>

<p>Services collaborate to satisfy a business process. Where two services communicate, at least one assumes the role of provider, the other of consumer. To the extent that the consumer uses something of the provider, it is coupled to that provider. In the interests of autonomy, process agility, reuse, and so on, we seek to reduce the degree of coupling between providers and consumers. But no matter how successful we are in loosely coupling services, we recognize that for a system to do something useful, some small amount of coupling must remain.</p>

<p>What does it mean to be coupled, one service to another? What relations or forces are at play between provider and consumer? Between a provider and all the consumers who depend upon it?</p>
<h3>Service Contracts</h3>
<p>We can begin answering these questions by reviewing our understanding of service contracts. Service contracts are often described as <a href="http://www.ibm.com/developerworks/wikis/display/woolf/Service+Contract" title="Bobby Woolf's definition of Service Contract" target="_blank">what the requestors and providers of a service must agree on</a>. In the WS-* universe, service contracts are expressed using commoditised, standards-based XML vocabularies:</p>
<ul>
	<li><strong>WSDL</strong> (Web Service Description Language) descriptions of a service’s operational behaviour – including structural definitions of the operations a service supports and the messages that go in and come out of a service – together with details of where to find a service and how to bind to it;</li>
	<li><strong>XML Schema</strong> descriptions of the messages sent and received by the service;</li>
	<li><strong>WS-Policy</strong> descriptions of any constraints on accessing and using the service, such as security requirements that a consumer must adhere to, or acceptable transports over which the service can be contacted. Policies separate these constraints from the service’s behaviour: if a service is relocated, perhaps to a new address or transport, its policy may change whilst its behaviour remains the same.</li>
</ul>
<p>Such service contracts promote loose coupling by encapsulating the provider’s execution environment, thereby increasing the platform independence of the several parties in a distributed system.</p>

<p>A key point to note about Web Service contracts is that they are almost always explicit, being published using one or more of the contract formats described above. With the standardisation of these formats, there arose widespread tool support for generating language-specific clients and message representations. Looked at in one way, this appears to be the natural maturation of the Web Services platform; looked at another, the volume of tool support hints at the development burden imposed by a service’s relative freedom to implement an illimitable number of operations and message schemas. Operations proliferate because there are no intrinsic constraints on the number or names of operations exposed by a WS-* service: your service exposes a <em>GetCustomerDetails</em> operation; mine supports <em>HandleCustomerDetailRequest</em>. Message schemas proliferate in large part because of the de facto predominance of XML. If all you have is XML, then the choice – if you can call it a choice – of media type adds nothing to the interpretation of a message. This leads us to innovate at the level of the structure of the representations we make using that one media type: all too often, your <em>Customer</em> schema ends up looking nothing like my <em>Customer</em> schema.</p>

<p>In short, the Web Services platform trades standardised, commoditised and constrained contract metadata in return for an unconstrained set of operations and message schemas. From the point of view of a consumer wanting to invoke operations on and exchange messages with service providers, each service differs from every other, thereby requiring a service-specific proxy per consumer. Hence the need for explicit contracts on the provider side and toolset support for generating proxies on the consumer side.</p>

<p>Unlike WS-* services, RESTful services typically eschew explicit contracts: but that doesn’t mean that RESTful contracts don’t exist. Stefan Tilkov discusses this very issue in his <a href="http://www.infoq.com/articles/tilkov-rest-doubts" title="Addressing Doubts about REST" target="_blank"><em>Addressing Doubts about REST</em></a>. The implicit RESTful contract is in large part captured by the HTTP specification, which describes a set of operations that can be performed on the resources exposed by a service, together with a set of response codes that guide a consumer’s interactions with those resources. Format-wise, REST encourages us to choose an appropriate IANA-recognised media type, such as XHTML, Atom, JSON, form encoding, or even XML, to structure a representation in the most economical and widely recognized manner possible. This focuses us on identifying potential structural similarities in our data, rather than essential semantic differences. A set of configuration parameters, for example, appears quite different from a customer’s contact details; leading us, perhaps, to create a <em>Config</em> schema for the one, a <em>Customer</em> schema for the other. But looked at in terms of their structure, both resources might be thought of as comprising sets of name-value pairs, making it practical to represent them in a widely recognised form-encoded format.</p>

<p>Whether implicit or explicit, service contracts to date have been overly provider-centric. In contrast to this monadic focus, <em>Consumer-Driven Contracts</em> distinguishes three types of contract: provider contracts, consumer contracts and consumer-driven contracts. I suggest that these contractual relations exist <em>whether we like it or not</em>. In a sense, we don’t opt to implement these contracts, least of all the consumer and consumer-driven contracts: they exist from the moment a service is up and running and being used by one or more clients. We’re not obliged to design and build to these contracts, but having named them and surfaced them as distinct from one another, we can leverage their characteristics if we so choose.</p>

<p>In my next post I’ll describe each of these three contracts in more detail.</p>]]></content:encoded>
			<wfw:commentRss>http://iansrobinson.com/2008/03/27/a-contract-vocabulary-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Consumer-Driven Contracts: A Retrospective</title>
		<link>http://iansrobinson.com/2008/03/22/consumer-driven-contracts-a-retrospective/</link>
		<comments>http://iansrobinson.com/2008/03/22/consumer-driven-contracts-a-retrospective/#comments</comments>
		<pubDate>Sat, 22 Mar 2008 02:54:41 +0000</pubDate>
		<dc:creator>iansrobinson</dc:creator>
				<category><![CDATA[Consumer-Driven Contracts]]></category>

		<guid isPermaLink="false">http://iansrobinson.com/2008/03/22/consumer-driven-contracts-a-retrospective/</guid>
		<description><![CDATA[

A couple of years ago I wrote about some of the challenges we face when evolving services in response to changes in the business processes they implement, or to changes in the way they are used by their consumers. The resulting article, Consumer-Driven Contracts: A Service Evolution Pattern, was published on Martin Fowler&#8217;s site and [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.pragprog.com/images/covers/190x228/twa.jpg?1202927366" alt="ThoughtWorks Anthology" align="top" /></p>

<p>A couple of years ago I wrote about some of the challenges we face when evolving services in response to changes in the business processes they implement, or to changes in the way they are used by their consumers. The resulting article, <em>Consumer-Driven Contracts: A Service Evolution Pattern</em>, was published on <a href="http://martinfowler.com/articles/consumerDrivenContracts.html" title="Consumer-Driven Contracts" target="_blank">Martin Fowler&#8217;s site</a> and shortly thereafter on <a href="http://msdn2.microsoft.com/en-us/library/bb286659.aspx" title="Consumer-Driven Contracts" target="_blank">MSDN</a>. This month I&#8217;m delighted to announce that a newly revised version can be found &#8211; in somewhat humbling company &#8211; in the fabulous <a href="http://www.pragprog.com/titles/twa" title="ThoughtWorks Anthology" target="_blank"><em>ThoughtWorks Anthology</em></a>.</p>

<p><em>Consumer-Driven Contracts</em> described what I perceived to be a common problem in real-world service-oriented solutions &#8211; that of the ostensibly loosely-coupled service estate being in fact extremely difficult to change on a service-by-service basis &#8211; and explained how we might make our service providers and consumers more independent of one another and better able to tolerate change. The article drew on my experience of building services in large organizations where, because of our schedule of frequent releases, we had to balance innovation with the minimum of system and organisational disruption. Besides discussing how we can engineer services that are tolerant of change, the article touched on several other topics related to the design and delivery of distributed systems &#8211; topics that interested me then, and continue to interest me today:</p>
<ul class="unIndentedList">
	<li> Are agile software methodologies compatible with delivering organizational agility in the context of a service-oriented approach to business process automation?</li>
	<li> How can we align the specification and delivery of service functionality with the key business process drivers within an organisation?</li>
	<li> What are the roles and responsibilities of the several parties in a loosely coupled relationship?</li>
	<li> Under what circumstances can we depend on toolset-assisted service implementations, and when should we adopt more deliberate &#8211; sometimes more complex &#8211; implementation strategies, to ensure the longevity of a system?</li>
	<li> How ought we to translate the collaborations between the business functions through which an organisation realizes its core processes into our services&#8217; externally observed behaviours and interactions?</li>
</ul>
<p>I&#8217;ve discussed the ideas in <em>Consumer-Driven Contracts</em> with many friends and colleagues over the last couple of years, and have learnt much by continuing to test and refine their application at ground level. Now with the recent publication of the <em>ThoughtWorks Anthology</em>, I thought it appropriate to conduct something of a retrospective. Beginning with my next post, where I&#8217;ll consider <em>Consumer-Driven Contracts</em> in terms of its describing a contract vocabulary, I&#8217;ll reflect on what I&#8217;ve learnt, unpick some of the several strands in the article, and dive further into some of its more important themes.</p>
<p><em>Updated: </em>The first three parts of this retrospective can be found here:</p>
<ul class="unIndentedList">
<li><a href="/2008/03/27/a-contract-vocabulary-part-1/" title="A Contract Vocabulary: Part 1" target="_blank">A Contract Vocabulary: Part 1</a></li>
<li><a href="/2008/04/01/a-contract-vocabulary-part-2/" title="A Contract Vocabulary: Part 2" target="_blank">A Contract Vocabulary: Part 2</a></li>
<li><a href="/2008/04/20/a-contract-vocabulary-part-3/" title="A Contract Vocabulary: Part 3" target="_blank">A Contract Vocabulary: Part 3</a></li>
</ul>]]></content:encoded>
			<wfw:commentRss>http://iansrobinson.com/2008/03/22/consumer-driven-contracts-a-retrospective/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
