I first wrote about interface compatibility in Compatibility And Evolution in an Asynch World and in protocol extensibility. I think I've gotten to a place where I can make a good stab at formally defining interface compatibility. I hadn't really thought through output operations and semantic guarantees, so I have to add those in.
The goal is to be able to describe whether 1 interface is compatible with another interface. We need to be able to specifically identify what are the invarients or constraints across interfaces that are necessary for compatible evolution. I'll expand upon my earlier definition..
An interface (i) consists of operations o1...on. Each operation has inputs in1 and outputs out1, looking something like:
i = o1(in1, out1)+ o2( in2, out2).
Another interface (i') is related to i by the operations it consists of:
i' = o1(in1', out1') + o2(in2', out2') + o3 (in3, out3)
Operations may be inbound or outbound. WSDL can describe output operations.
Based upon the operations and their parameters, we can say:
i' is compatible with i IFF:
- for each inbound o in i, there exists the same identified o in i'. No operations are deleted.
- for each inbound o in i, the i'.o is semantically compatible with i.o. No operations are semantically backwards incompatible.
- each inbound o in i' that does not exist in i must be ignorable. No mandatory operations can be added.
- for each inbound o in i, in can be converted to in'. Each operations inputs are backwards compatible with the previous version
- for each inbound o in i, out' can be convert to out. Each operations outputs are forwards compatible with the previous version.
- for each outbound o in i' that is required, there exists the same identified o in i. No mandatory "responses" are deleted.
- for each outbound o in i' that is not in i, the o can be ignored by the receiver.
- for each outbound o in i, the i.o is semantically compatible with i'.o. No operations are semantically incompatible.
- for each outbound o in i, in' can be converted to in. Each operations inputs are forwards compatible with the previous version
- for each outbound o in i, out can be convert to out'. Each operations outputs are backwards compatible with the previous version.
I think this is the rough set of constraints that, if satisfied, mean that all v1 clients can continue to work with V2 interfaces.
An obvious next blog entry: what does Web, XML and Web service technology give us to make these compatibility guarantees?
Leave a comment