How does an API work?
An API (or Application Programming Interface)
functions through the definition of the service it provides. Defining
an API means identifying the objects that make up the service. For
example, an Authorization API would contain objects such as a Person,
a Function to be performed, a Qualifier that gives the context for
performance of the Function, and the Authorization itself. Defining
the objects involves not only naming them, but also determining
what information they contain. To complete the definition of an
API object it is necessary to define how the information in an object
can be accessed.
Definitions of objects associated with an API
go a long way toward defining the rest of the API. For any collection
of objects there is set of things that can be done with the objects.
Examples of things that can be done with an Authorization API include
determining who can perform which functions in a qualifier context,
or determining who has authorization to perform a function.
Most of this work can be done outside the constraints
of a programming language, but for a programmer to be able to use
the API, it must be cast into a programming language. O.K.I. will do
this casting into Java; the API object definitions will become Java
interfaces. The advantage of a Java interface is that it is well
defined and the programmer can use it when writing the application,
but it does not imply a specific implementation.
Functions performed with API objects are collected
into a Java class that is called a Factory. The Factory collects
Functions and binds them to an implementation of the API. The API
objects are represented with Java interfaces. The Factory provides
a way for the application to get instances of these API object interfaces.
After an API is created, an application may access any implementation
of the API through the Factory.
|