Interfaces Are Good

Interfaces provide separation of facility. Different parts of a system are typically interested in different qualities of the objects they meet. For example, the storage facility might want to know whether an object can be serialized to a string. On the other hand, the accounting system might want to know whether the object represents a transaction, and if so what the cost associated with it is.

The classic ObjectOriented notion of each object having exactly one type is too restrictive, as it forces other parts of the system to be aware of many qualities that are incidental to the task at hand. While an inheritance hierarchy provides a nice ordered model of the specialization of objects -- "what is this object?" -- it does not help with the more interesting question: "can I do X with this object?".

Interfaces allow the inheritance tree to become a relational graph.

-- DavidKTurner


See also ThereAreNoTypes, GenericProgrammingIsBetter.


EditText of this page (last edited May 10, 2004) or FindPage with title or text search