Versioning Interfaces

I thought I’d share a bit of this thread we are having now over a large internal alias… As always your comments welcome:

Questions:

I have an interface (IFooExtension) which has shipped. This interface is public, documented and used by third parties to write custom “plugins”. For the next version, we want to improve this interface (add methods, delegates …). What is the recommended way to name the new version of the interface IFooExtension2, IFooExtensionEx or something else?

My response:

Well, first off I’ll say that on the surface it looks we have “teaching moment” here. So forgive me while I get on my soap box… Had you elected to use a base (or abstract) class rather than an interface for this you would not be in the position you are in right now. You should only use interfaces when you have high confidence that the scope of the interface is small enough that it is unlikely to be versioned in the future. You are now forcing some very ugly, com-like API design on our customers. You, and others designing V1 APIs should take this as an opportunity to revisit each of your interfaces and double\triple confirm that you will not need to version that interface in the future.

That said, the first thing I would suggest is provide a meaningful name… consider what additional functionality you are adding and use that in the name… such as ISeedSecurityExtension or something like that. See IDispatchEx2 here we come...  and the comments for more context.

If after drawing on the sum total of your teams creativity you are not able to come up with any meaningful name then the guideline is to use ISeedExtension2 as it seems likely you will need a ISeedExtension3 and ISeedExtension4 eventually as well given your track record ;-)