Skip to main content

Questions related to teaching about interfaces in the object oriented paradigm. A class implementing an interface is considered to have "signed a contract", which ensures that has methods described in the interface. DO NOT use this tag to ask about interfaces in general, OR about user interface.

In the Object Oriented Paradigm, an interface (sometimes called Protocol) is a means for unrelated objects to communicate with one another. An interface defines method signatures, and those methods must be be present in any object which implements the interface.

Interfaces can be thought of a description of:

  1. Methods that are used by the object.
  2. Arguments that those methods receive.
  3. The return type of those methods.
  4. Invariants that are not changed by those methods.

More information about interfaces (specifically in java, but also contains details which are not language-specific) can be found here