Udostępnij za pośrednictwem


TCM Public API: Why Interfaces?

Some of you who have started working with the TCM OM might wonder why we provided the interfaces for public  consumption instead of classes, and whether there is any implication about your own implementation of our interfaces.

Here is a short note copied from an email by our Development Lead, Justin Pinnix:

These interfaces are not intended to be implemented by users, but they are intended to be called by them.  

We use a pattern that is different from most other .NET framework classes (though is the same pattern that Team Build uses). Most .NET frameworks provide a set of public class objects that contain methods that are the public APIs. Both the implementation and the definition of the API are in the same place – the public class. Instead, we have a separated model. We define the public APIs in pubic interface objects, but we implement them as internal class objects. This provides complete separation of the definition and implementation and allows us to completely change out the implementation at a later date.

While it is true that a user could create their own class that implemented our public interfaces, that is not the intent.

We followed a decision to convert TFS APIs to this pattern. However, the decision was later reversed.