Exciting new approach to versioning interfaces (courtesy of the Biztalk Team) (reposted)

We installed Biztalk 2004 SP1 at work here today, and in the process I discovered an exciting new approach to versioning interfaces from the Biztalk team. Rather than going to the trouble of creating a brand-new interface, and the hassle of thinking up a new name (as suggested here), they decided to just go and ADD METHODS TO THE INTERFACE. They added the GetEventStream() method to the IPipelineContext interface (which lives in the Microsoft.BizTalk.Component.Interop namespace). Wow. Why haven’t others thought of this simple and clean way of versioning interfaces?

(c’mon people - what do you think? was that too sarcastic?)



Not sarcastic enough.

This works in the forward direction if you control all the implementations, but not the backward. Someone compiled against the new method will have a nasty failure when running against the older version.

If you handle that problem in another manner, you run into the trouble of people who implemented the old interface and thus don’t have an implementation for the new method. Again if this is COM-like where the interfaces really are only implemented by one developer then it may not be a concern, but if the interface was an extensibility point then you have issues.

In the .NET world, abstract classes seem to do a better job of handling the scenaris where this works, because you do indeed just add the method, and you can additionally provide a default implementation.
16/11/2005 12:03:00 PM