I
Interface Invariant
(Say) I define Interface 'X' and implement it in
Class 'Y'.
Why, according to the interface invariant, must I create
a new interface if I want to modify any methods, members,
properties, indexers and events defined within it?
If I change, for example, a return type of a method in
Interface X, then why should it make sense to create a
whole new interface with the new return type, rather than
change it in the existing interface and do any required
changes in Class Y?
Seems to me that re-creating the interface has order of
n+1 complexity, where n is the total locations in class Y
where I have to do changes to re-establish the interface
contract, and 1 is the name of the Interface, which will
be changed in Class Y (not considering the overhead
involved in creating the new interface).
At the end of the day, the answer may reside in the large-
system situation, where it will be rather inneficient to
detect and correct Interface contract infringement, so it
might as well reside on the compiler capability to signal
that infringement and lead the developer to correct the
implementation details.
Comments?
Louis
Class 'Y'.
Why, according to the interface invariant, must I create
a new interface if I want to modify any methods, members,
properties, indexers and events defined within it?
If I change, for example, a return type of a method in
Interface X, then why should it make sense to create a
whole new interface with the new return type, rather than
change it in the existing interface and do any required
changes in Class Y?
Seems to me that re-creating the interface has order of
n+1 complexity, where n is the total locations in class Y
where I have to do changes to re-establish the interface
contract, and 1 is the name of the Interface, which will
be changed in Class Y (not considering the overhead
involved in creating the new interface).
At the end of the day, the answer may reside in the large-
system situation, where it will be rather inneficient to
detect and correct Interface contract infringement, so it
might as well reside on the compiler capability to signal
that infringement and lead the developer to correct the
implementation details.
Comments?
Louis