An
Application Program(ming) Interface, or
API, is a mechanism by which one software system or component may interact with another.
Tcl and
Tk both have
script-level and
C-level (
Tcl C API/
Tk C API) APIs.
Description edit
When designing an API, consider
exposing functionality rather than exposing data. When clients of an
API access data through commands/functions/procedures instead of directly, the API provides a layer of abstraction between the clients and the code base. When clients access data directly, there's an additional burden on developers of the code base not to break said clients. Interfaces that do expose data are often eventually changed to expose functionality instead. This has happened with the the Tcl
C API. Examples include
Tcl_SetObjResult and
TIP 445, Tcl_ObjType Utility Routines.
Further Reading edit
- APIs Considered Harmful, Sean McGrath, 2002-04-18
- A critique of meta APIs such as those that try to abstract services available over HTTP.