procedures, exception specifications and method signatures. In some instances, it may be useful to define variables as part of the interface. It often also specifies the
functionality of those procedures and methods, either by comments or by formal logical assertions. [2]
As an example:- The interface of a software module A is deliberately kept separate from the
implementation of that module. The latter contains the actual code of the procedures and methods described in the interface, as well as other “private” variables,
procedures, and etc. Any other software module B which can be referred to as a client to A that interacts with A is forced to do so only through the interface. One
practical advantage of this arrangement is that replacing the implementation of A by another one that meets the same specifications of the interface should not cause B to
fail as long as its use of A complies with the specifications of the interface.
2.2.1 Use of Interface
The concept of interface is the foundation of modular programming, a pioneer and a standard ingredient of object-oriented programming. In object-oriented
programming, an object’s interface consists of a set of methods that the object must respond to. Note that the object does not make its instance variables a part of its
interface. These are typically proved by means of access methods. Some object- oriented programming languages command that the interface to the object be
specified to the compiler separately from the implementation of that object, while others relax the requirement. For example, a class in a programming language such
as Objective-C consists of its interface, specified in a header file, and the implementation in the source file. Because of the dynamically typed nature of
Objective-C, one can send messages to any object, and the interface to the class becomes important as it specifies the methods the class responds to. Some
programming languages support private and protected implementation of an interface. Thus, the public methods declared in an interface can easily become
private or protected methods of a class implementing the interface. [2]
The Eiffel language includes in the interface of a class its invariants and the pre- and post conditions of the methods of the class. This is essential to the
methodology of design by contract, and may be regarded as an extension of the conditions imposed by the types of the arguments. These rules may be specified in
the implementation of a class or in an ancestor which may leave the methods unimplemented. They are extracted by language processors to provide an interface
view in the development environment and to generate run-time assertions checks in debug versions. The language also ensures that derived classes obey the contracts of
their ancestors.
2.2.2 User interface