Site Archive (Complete)
Architecture Blog: Liskov's Substitution Principle and SOA
Architecture & Design
PATTERN LANGUAGE

Modeling, Managing, Making it Right.

by Jonathan Erickson
IF YOU BUILD IT

... Will they Come?

by Arnon Rotem-Gal-Oz
October 11, 2006

Liskov's Substitution Principle and SOA

Working on my SOA patterns book, I thought of this rule for contract versioning which my shameless ego wanted to dub "Arnon's Contract Versioning Principle." I was happy playing with this thought, until I realized that there isn't some profound new understanding here -- this is just an application of LSP for service contracts.

Liskov Substitution Principle (LSP), which I recently blogged about here as part of a series of blogs on Object-Oriented Principles, basically states that a subclass should be usable instead of it parent class. To put this in other words, you could say that a subclass should meet the expectations that users of the parent class have come to expect from the parent class's observable behavior.

So LSP applied to SOA would state that:

When changing the internal behavior of a service, you don't need to create a new version of the contract if for each operation defined in the contract the preconditions are the same or weaker and the postconditions (i.e. the outcome of the request) are the same or stronger or in other words the to retain the same contract version, the new version of the service should meet the expectations that consumers of the service have come to expect from the old version's observable behavior.

For example, let's say you have a customer service and the contract lets you get a customer's VIP status. If you changed the way the VIP status is calculated (e.g. in the old version the customer had to have $1 million in her account, but now she must have $10 million) there's no need to create a new contract version. However if you introduced a new level of VIP status (e.g. 1 Million = Gold, 10 Million = Platinum) you do need a new version for the contract.

Posted by Arnon Rotem-Gal-Oz at 02:40 PM  Permalink




 
INFO-LINK


Related Sites: DotNetJunkies, SD Expo, SqlJunkies