Brisbane Meeting – July 2006

Monday 24 July 2006

Interfaces without COM – Alex Fekken (Fekken IT Services)

Another back-to-basics presentation. Traditionally, Interfaces have been associated with COM programming, but especially with the introduction of the .NET framework we see interfaces popping up all over the place. In this presentation we will look at how interfaces are useful in their own right without any reference to COM.

We will work from the usual motivation of Interfaces as a substitute for multiple inheritance. What this means is that classes without a common ancestor can be tied to a “contract” for common functionality (the interface). This then allows objectsof these classes to be used interchangeably(“polymorphically”) as if they would descend from acommon ancestor, at least as far as the functionality specified by the interface is concerned.

As an example we will show how to use a sorting interface to extend pre-existing classes into “sortable classes” that re-use the same sorting algortihm. As the example shows, the strengthof Interfaces lies in the fact that pre-existing classes can be extended to implement a given interface”after the-fact”, regardless of their inheritance tree.

Posted in Brisbane, Meetings Tagged with: