In a new article, Ian Robinson, a Principal Consultant with ThoughtWorks, discusses how "consumer-driven contracts", in the form of "stories for services" and unit tests exchanged between service development streams, can strengthen the service-oriented development lifecycle. In contrast to contracts defined from the point of view of the provider, consumer-driven contracts result from combining the demands of all known service consumers.
Ian introduces consumer-driven contracts as they relate to provider contracts and consumer contracts:
- Provider contracts - Provider contracts are the kind of service contract with which we are most familiar -think WSDL plus XML Schema plus WS-Policy. Provider contracts are, as the name implies, provider-centric. Providers mandate what they have to offer; each consumer then binds itself to this one-size-fits-alloffering. By adopting a provider contract, a consumercouples itself to the entirety of the provider's functionality, irrespective of how much of this functionalityit really needs.
- Consumer contracts - A consumer contract, on the other hand,is a more exact description of an individual consumer's needs. Consumer contracts represent the specific pieces of provider functionality required by that consumer in the context of a particular interaction. Consumer contracts can be used to annotate an existing provider contract, or they can help discover an as-yet unspecified provider contract.
- Consumer-driven contracts - A consumer-driven contract is a representation of a service provider's obligations to all its current consumers. Consumer-driven contracts are created when each consumercommunicates to the provider its specific expectations. The obligations created on the provider's side establish a consumer-driven contract. As part of adopting a consumer-driven contract, a provider is free to evolve and innovate its service offering just so long as it continues to satisfy its existing obligations
The author then explores how consumer-driven contracts can be used within the phases of the service development lifecycle, ranging from the initial phase through building and operating them.
Ian summarizes:
Consumer-driven contracts support the development and testing of service-oriented systems, and encourage collaboration between all parties responsible for the service lifecycle.
Check out the full article for more.