Default Interface Implementations

I just read this post over at the Enigmativity blog about default interface implementations in both C# and VB.NET as encouraged by the IDE. The article points out some useful facts like how you can manipulate the name of the public implementing method of an interface in VB.NET whereas you can’t in C# but I think that the argument that default interface implementations are bad OOP is wrong isn’t really fair.

As a programmer who has used a number of OO languages, I can probably count on one hand (two at most) the times when I’ve had a name conflict with a method or property on an interface that a class that I’ve implemented.

I’m convinced that encouraging default implementations is more about usability for the developers who are really just implementing an interface for the sake of completeness (for example, IDisposable). If they couldn’t use a default implementation and avoid the cast or “as” operator they might just avoid implementing the interface all together which would be a real loss.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s