The .NET coding instructions say that having an empty base class or interface (also called a tag interface) is really bad style. The preferred style is to use an attribute instead of commenting on classes of the same type. There is also an FxCop rule to enforce this agreement.
However, sometimes I (in rare cases) use this idiom when a common base class is useful to indicate a common hierarchy, even if there is no common functionality. Attributes cannot be used for this.
For example, in the interpreter for a programming language, several methods return a special base class Value , that is, something that matters inside this programming language. Basically, this value can be anything from a number to a string (which are special classes, not System.Int32 or System.String ) for a compound object. I could also return System.Object , but that would facilitate the typing of my public interface.
Good, self-documenting code profits from a limited interface.
Konrad Rudolph
source share