Interfaces are a very useful language feature, but are much abused. Symptoms include:Why do most system architects insist on first coding to an interface? - Stack OverflowAll these things are code smells, IMO.
- An interface is only implemented by one class
- A class implements multiple interfaces. Often touted as an advantage of interfaces, usually it means that the class in question is violating the principle of separation of concerns.
- There is an inheritance hierarchy of interfaces (often mirrored by a hierarchy of classes). This is the situation you're trying to avoid by using interfaces in the first place. Too much inheritance is a bad thing, both for classes and interfaces.
(Jim Cooper)
Blogged with the Flock Browser
1 comment:
I think that the "code smells" are too generic too be "true" smells. It depends much by the context, therefore the "smells" aren't always applicable.
It seems to me "too simple" to define these rules therefore I don't agree.
Post a Comment