Service-Oriented Development with Consumer-Driven Contracts

July 28th, 2008  |  Published in Behaviour-Driven Development, Consumer-Driven Contracts by Ian Robinson  |  5 Comments

A few months ago Stefan Tilkov very kindly offered me the opportunity to write about consumer-driven contracts for InfoQ. The resulting article, “Service-Oriented Development with Consumer-Driven Contracts” 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 Ian Cartwright for lots of conversation and encouragement.

I’ve still not written much on how to implement consumer-driven contracts, but I’ve something special cooking (slowly) in that area: expect some illustrative material to emerge over the next few months.

5 Comments  |  Atom   RSS 2.0   Email

Responses

  1. Nick Gall says:

    November 15th, 2008 at 6:31 am (#)

    Ian, just read the InfoQ article (actually skimmed it as i’ts late here in Boston — I’ll read it more closely tomorrow) and just wanted to let you know that consumer-driven contracts have already been extensively implemented for quite a while (2004?) — at Amazon!

    They simply call it the XSLT Service: http://docs.amazonwebservices.com/AWSEcommerceService/2006-06-07/PgXsltArticle.html . Several articles were written about it ( http://blogsearch.google.com/blogsearch?hl=en&um=1&ie=UTF-8&q=amazon+%22xslt+service%22&scoring=d ), including one that shows you how to transform from Amazon XML to JSON (!): http://www.kokogiak.com/gedankengang/2006/05/consuming-amazons-web-api-directly.html .

    I’m eager to hear your implementation thoughts as well in the coming months.

  2. iansrobinson says:

    November 17th, 2008 at 12:05 pm (#)

    Hi Nick

    Thanks for the links – I’ll check them out in more detail later this week.

    ian

  3. Colin Jack says:

    November 26th, 2008 at 11:36 am (#)

    “I’ve still not written much on how to implement consumer-driven contracts, but I’ve something special cooking (slowly) in that area: expect some illustrative material to emerge over the next few months”

    I wondered whether this will include discussion of how REST is affecting your thinking, I know you discussed this in your third post on the topic but I’d be very interested in reading more.

  4. iansrobinson says:

    November 27th, 2008 at 10:39 pm (#)

    Hi Colin

    For quite a while I’d thought that my interest in consumer-driven contracts didn’t quite square with my interest in RESTish solutions – at least in the way I narrowly concentrated in my CDC work on asserting expectations against schema.

    But last week I saw Stu Charlton’s terrific presentation on “Designing Enterprise IT Systems with REST”. Even if Stu hadn’t mentioned consumer-driven contracts – which he did – I couldn’t have failed to pick up on how his hypermedia alternative to the classic SOA interface is overtly consumer-oriented. There’s something there that chimes with what first motivated my version of consumer-driven contracts: I haven’t quite sorted it out in my head, but I’m hoping it’ll become clearer the less I think about it…

    The biggest influence REST has had on my CDC thinking to date is in the area of representation format. In the past, I’d really only focused on XML and XML Schema, and had used XPath, XmlUnit and Schematron to write consumer contracts. But I now appreciate the need to support a wider range of formats – perhaps even multiple formats for the same resource. To that end, in the odd few hours I’ve had spare over the last few months I’ve been writing a simple YAML-like DSL for expressing consumer contracts. This DSL can be used to declare an interest in parts of a resource representation, but without implying a particular representation format. I can then transform a DSL representation and generate assertions that target XML, JSON, YAML, name-value pairs, etc. More excitingly, I can also generate a network graph that represents what a provider has to offer and what one or more consumers expect of that provider. And off the back of that graph, I can generate another DSL representation of consumer expectations – this time of the aggregate set of expectations, the consumer-driven contract. In other words, social networks for services and contracts.

    So what I’d like to do in the near future is finish off a first version of this DSL and open source it. Please petition my employers (ThoughtWorks) to grant me excessive leave to indulge my hobby 🙂

    (And I still owe you a reply to another comment elsewhere…)

    ian

  5. Colin Jack says:

    November 28th, 2008 at 2:24 pm (#)

    Wow, thanks for the detailed reply.

    Using a DSL sounds very interesting, I hadn’t actually considered the effect that multiple representations would have but that seems like a great solution.

    In fact I wonder if being able to visualize the the entire consumer-driven contract (CDC makes me thing of biological outbreaks) would lead to interesting side-effects. For example letting you see whether multiple clients are using one resource but are actually using it in very different ways which might lead to you questioning your resource design. Mind you, based on discussions with people like Alan Dean who know way more about REST than I ever will, I’m thinking that resource design is a very complex topic involving balancing multiple forces so anything that can help avoid pitfalls would be good.

    Consider the petition sent but I guess the trick would be to find someone influential who happens to be writing a book on DSLs. Also no need to reply to my other comment, not sure I was saying anything interesting anyway.