More about Interface usage in .NET

In a recent post I shared some personal experiences about when to use interfaces or abstract classes.

As it turns out, internet is full with information and advice about it:
  • Evan Hoff has an interesting post dividing the interface usage scenarios into three groups: interfaces modeling object characteristics, capabilities and complex entities. To reiterate, the only reason I see to model a complex entity as an interface is that implementations will use more than one base class as roots of the class hierarchy.
  • Thomas Gravgaard in the post Random Ramblings and Rumblings: The Interface Tax confirms my experience about duplicating members in both a class and its interface. I totally agree with him, that an interface in this case is mostly redundant and not justified. I also learned the cool YAGNI acronym. If you speak German, I like this description more.
  • An advice to avoid marker interfaces is ubiquitous, although I still can't find any justification for it. I'll disagree with this advice in my future post.

No comments: