Interface
Definition
- An interface "is a set of named operations that can be invoked by clients" (Component Software, p. 40).
- An interface is given by a contract that completely specifies the operations within the interface and any pre-conditions and post-conditions that may exist for those operations.
- An interface can be provided by either a component (as with traditional libraries) or an object made available by a component.
Notation
The symbol for an interface is a line segment with a circle at the end:
The line segment may begin at any of four other symbols. If the interface is connected to an object symbol, it indicates that the object supports that interface:
If the interface is connected to a class symbol, it indicates that objects instantiated for that class will support that interface:
If the interface is connected to a component it means that the component supports that interface. This typically requires the component to instantiate a singleton object that supports the interface and maintains some knowledge about the component as a whole:
If the interface is connected to a module it means that the module supports that interface. This typically requires the module to instantiate a singleton object that supports the interface and maintains some knowledge about the module as a whole: