What is an interface?
Interfaces are a set of required functions necessary for a specific task. Interfaces define a strict contract of interaction and expectation between two or more software elements, but leave the implementation details to the code that implements the interface. In many cases, the person who writes the interface is different from the person who writes code to implement the interface.
If a Gosu class implements an interface, Gosu validates at compile time that all required methods are present and that the implementer class has the required method signatures.
PolicyCenter defines interfaces that PolicyCenter calls to perform various tasks or calculate values. For example, to integrate PolicyCenter with a document management system, implement a plugin interface that defines how the application interacts with a document management system. The implementation details of document management are separate from the contract that defines what actions your document management code must handle.
A physical example of an interface is a car stereo system. The buttons, such as for channel up and channel down, are the interface between you and the complex electrical circuits on the inside of the box. You press buttons to change the channel. However, you probably do not care about the implementation details of how the stereo performs those tasks behind the solid walls of the stereo. If you get a new stereo, it has equivalent buttons and matching behavior. Because you interact only with the buttons and the output audio, if the user interface is appropriate and outputs appropriate sounds, the internal details do not matter to you. You do not care about the details of how the stereo internally handles the button presses for channel up, channel down, volume up, and volume down.
See also
