Monday, June 26, 2006

Why Service Interface != implementation

One of the assumptions that some people make is that if the interface and contract are the same then the implementations must behave in the same way. Sometimes this is manifest in an idea that a service implements one and only interface, other times its just an assumption people make when doing testing or an upgrade.

So here are three examples from Google Maps, the AA and Multimap of exactly the same route request from Trafalgar Square, Westminster, Greater London, SW1 to Trafalgar Square, Gosport, Hampshire, PO12. No particular reason it just seemed like a reasonable test. So the interface for these two is exactly the same when viewed as a service. We have two input parameters and in return we get a list of directions and a Map. Our preconditions (that the places exist) and post conditions (the route is possible) are the same so from any service consumers perspective these two elements are identical. Ignoring the formatting differences of the pages there are a couple of things to note
  1. Google Maps is clearly US developed, it uses street names far more than its UK based cousins which focus on the route number (e.g. A4)
  2. All produce different distances and times
  3. All go via slightly different routes
So from a consumers perspective they meet the post-condition but the ability of the consumer to follow the process may vary based on how the process (route) has been described. Here for instance Google Maps produces a set of directions that are a bugger to use around London as you don't want to be looking for the names of the streets when there is a great big "A4" sign at the junction.

So Service Implementation can definitely differ for a single interface, and regional differences between services shouldn't be under estimated. So when you are looking at that global logistics planning service do remember that people in different countries navigate the roads differently, simply meeting the post-condition might not meet the required business objective. This is one of the reasons that I like to capture business priorities and drivers against actions, so a driver here wouldn't just want "fastest route" they'd want "simple to follow" as well.

Google Maps also demonstrates another rule for SOA, one service implementation can expose multiple interfaces to the world. So as well as routes you can find out who in London is doing service architecture and the stunning revelation that there is no beer in Sydney (tough luck on the aussies today in many ways).

  • Same interface != Same implementation
  • interface can have more than one implementation
  • an implementation can implement more than one interface
  • Regionalisation is important, even when you meet all your semantic and functional contracts.
  • Services don't have to have WSDL interfaces

Technorati Tags: ,

No comments: