Frank Sommers
Posts: 2642
Nickname: fsommers
Registered: Jan, 2002
|
|
Re: Contracts and Interoperability
|
Posted: Nov 4, 2003 4:20 PM
|
|
The versioning stuff Anders talks about sounds to me like a good way to build even more complexity into systems. To me, the whole point of relying on interfaces is that I don't have to care about specific implementations of that interface, including versions. To me, the interface alone defines the identify of the object - if I change the interface, I changed the identity of object. With versioning of an interface, if I'm allowed to make major changes to an interface, and still call it the same interface, am I not making a philosophical error of a sort (with grave practical consequences)? I think this issue is really the application of Plato's Ship of Theseus problem to software design. It boils down to what defines the identity of an object: Is it its interface? Its's version plus its interface ("strong name")? Its interface plus the codebase where its classes came from?
I think that introducing versioning when defining an object's identity makes it more difficult to identify an object, and hence makes programming and system management burdensome. If object X adheres to the Food interface, but then, in version 2, I add a few methods from the Poison interface to it as well, is X now food or poison? I can't blame you if you prefer not to touch such an object, and rather create your own version (version 3), leading to more complexity.
I always thought that buggy implementations are weeded out over time by better implementations, in a Darwining fashion. If I program an object to interface X, and an implementation of X happens to be buggy, I may program around that bug, but I definitely want to know when the bug is fixed, and I'd definitely want to change my object to the corrected version.
The open source model seems to favor this method as well: If the source to a critical implementation is available, others relying on that implementation can fix the problems, and contribute their fixes back. Or, if the source is not available, but the interface is published, others can possible create a competing, less bug-ridden implementation.
|
|