I Don't Believe In Interface Versioning
I was thinking about how to implement folder recursion for CarbonCopy.NET while taking a shower earlier, and somehow my mind wandered to the topic of interfaces. In. .NET 2.0, I'm told that you'll bee seeing new versions of interfaces implemented like this: IDataReader2 for the new ones, so that old code can still support IDataReader. Does anyone else think this is a really lame way to design an API? What happens when you have .NET 6.0 (VS.NET 13.0 for those of you keeping track) in 8 years.... are we going to have to browse through:
IDataReader
IDataReader2
IDataReader3
IDataReader4
IDataReader5
IDataReader6
and try to figure out which one we want to use? yeah THAT sure sounds like fun. As if I didn't have ENOUGH framework classes that I need to know. Just think of how many Interfaces are present in the Framework. Multiply that by 6 versions, and suddenly you have a whole lot more people coding for Linux.
The Framework has this really neat and elaborate way to extend code through attributes. Isn't there a way that Interfaces could be decorated with attributes that let each inteface declaration know which version of the Runtime it supports? That way, you always get the best support possible for your current version of the Framework, all the time. VS.NET would only show supported items in IntelliSense, and all contracts would be binding, all the time, under one Interface name. The JIT compiler would dynamically create a virtual interface at compile time, under the covers, based on the executing version of the Framework and those attributes.
Is this not an option? Do I just not understand the CLR enough to see why this wouldn't work?
UPDATE: You'd also want custom attributes to set up your own versioning scheme, in case you need to create your own Interfaces for binding in your own code. That way, your custom interfaces don't have to be tied to specific versions of the Framework.