Some Design Recommendations

Contracts are sensitive matters. This is no different for interfaces, so some design recommendations are in order to ensure that you don’t paint yourself in a corner when defining interfaces or abstract base classes.

Versioning

Interfaces are particularly weak in the context of versioning of code. Once an interface has shipped and customers are implementing it, it’s a breaking change to add members to the interface in subsequent releases. Because of this, it’s never a good idea to define interfaces that do a bunch of unrelated things, as their “dumping ground” for a potpourri of members will last for only a single release. Instead, make sure an interface does one thing well.

Or Should I Use a Class?

Because of the ...

Get C# 5.0 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.