Friday, February 17, 2006

What's in an Interface ?

An interface is the contract of the abstraction with the world. As Erich Gamma states, an interface "distills the collaboration between objects" and "defines the vocabulary of the collaboration". Martin Fowler uses the nice term published as opposed to public to differentiate the interface api with other public methods.
Check out the latest in the interface contract with Christopher Diggins in his blog The Backside of an Interface. Think of interfaces as not only the published apis, but also the objects on which the abstraction depends on. Scala provides some nicer features for modular composition of interfaces through the usage of Abstract Type Members and Mixins. Martin Odersky talks about these details and how Scala interfaces go beyond the standard monolithic apis to provide a richer component model in OOPSLA 2005.
In summary, what I learnt is the observation that a formal or informal specification of a class's interface should also include the classes upon which it depends.

No comments: