Application Programming Interface - Detailed Explanation

Detailed Explanation

An API may describe the ways in which a particular task is performed. In procedural languages like C language the action is usually mediated by a function call. Hence the API usually includes a description of all the functions/routines it provides. For instance: the math.h include file for the C language contains the definition of the function prototypes of the mathematical functions available in the C language library for mathematical processing (usually called libm). This file describes how to use the functions included in the given library: the function prototype is a signature that describes the number and types of the parameters to be passed to the functions and the type of the return value. The behavior of the functions is usually described in more details in a human readable format in printed books or in electronic formats like the man pages: e.g. on Unix systems the command man 3 sqrt will present the signature of the function sqrt in the form:

SYNOPSIS #include double sqrt(double X); float sqrtf(float X); DESCRIPTION DESCRIPTION sqrt computes the positive square root of the argument. ... RETURNS On success, the square root is returned. If X is real and positive...

That means that the function returns the square root of a positive floating point number (single or double precision) as another floating point number. Hence the API in this case can be interpreted as the collection of the include files used by the C language and its human readable description provided by the man pages.

===Documentation===

Many program development environments provide the documentation associated with an API in some digital format, e.g. perl comes with the tool perldoc:

$ perldoc -f sqrt sqrt EXPR sqrt #Return the square root of EXPR. If EXPR is omitted, returns #square root of $_. Only works on non-negative operands, unless #you've loaded the standard Math::Complex module.

python comes with the tool pydoc:

$ pydoc math.sqrt Help on built-in function sqrt in math: math.sqrt = sqrt(...) sqrt(x) Return the square root of x.

Java comes with the documentation organized in HTML pages (JavaDoc format), while Microsoft distributes the API documentation for its languages (Visual C++, C#, Visual Basic, F#, etc...) embedded in Visual Studio's help system.

Read more about this topic:  Application Programming Interface

Famous quotes containing the words detailed and/or explanation:

    Modern tourist guides have helped raised tourist expectations. And they have provided the natives—from Kaiser Wilhelm down to the villagers of Chichacestenango—with a detailed and itemized list of what is expected of them and when. These are the up-to- date scripts for actors on the tourists’ stage.
    Daniel J. Boorstin (b. 1914)

    Auden, MacNeice, Day Lewis, I have read them all,
    Hoping against hope to hear the authentic call . . .
    And know the explanation I must pass is this
    MYou cannot light a match on a crumbling wall.
    Hugh MacDiarmid (1892–1978)