|
In the Patterns Subdirectory there is a file named ISubject.cs with:
namespace IssueVision { // ISubject is a simple marker interface that supports the implementation // of the Observer pattern in IssueVision. public interface ISubject { } }
Now.. a marker interface is "A so-called marker interface is a (Java) interface which doesn't actually define any fields. It is just used to "mark" (Java) classes which support a certain capability -- the class marks itself as implementing the interface.
This is a very good design for Java... but this is not JAVA this is .NET and in .NET we have something called "Attributes": .NET provides a mechanism for defining declarative tags, called attributes, which you can place on certain entities in your source code to specify additional information, for example "TO KNOW IF IT SUPPORTS A CERTAIN CAPABILITY"... Attributes are "the right way" to do this in .NET, not "Marker Interfaces"... Marker Interfaces are for languages that do not support custom metadata... (like Java... (until Java 1.5 is released))
Oh.. and I think Interfaces with no methos are not CLS complaint....
So.... am I missing something? Why the IssueVision team didn't use Attributes?
|