What is the difference between API, library and Framework?


These are very close terms and I have already found texts that exchange these concepts, as if in certain situations the definitions are almost the same.

What are the technical definitions that distinguish a API from a library or a Framework ?

Are there situations in which it is allowed to exchange these terms without committing a violation of the correct technical definition?

asked by Adolfo Correa 10.09.2016 в 05:09

2 answers

  • A library is a set of elements (functions, classes, predefined types, constants, global variables, macros, etc.) that can be used in a program to facilitate the implementation of that program.

  • API comes from the English "Application programming interface" which means "Interface for application programming". It is the part of a library accessed by a program that uses the library; thus making use of the library independent of the implementation details. An API can be implemented by different libraries.

  • A framework is an integrated set of tools that facilitate software development. It can include APIs and libraries. But it can also include other elements such as debugging tools, graphic design, prototyping, editing, etc.

The terms API and library are often used interchangeably. But keep in mind that an API is always unique (leaving aside different versions) and that an API does not include implementation details. While a library does not have to be unique and must contain a full implementation. The fact that an API is unique is very important, it is what allows writing a program in C ++ for Linux and that this program, unmodified, works for Mac if the libraries it uses are available for both systems.

An example of a library is Oracle's JavaMail. It is possible to make a program that sends emails by programming sockets directly. But it is much faster to use JavaMail or any other library for emails because these libraries already implement the functionality you need. Besides being faster it is also less prone to errors, especially in a widely used library; because the code is tested by millions of users and the development community will generally do a better job than the team of an individual program can do.

CORBA is an API. But there may be an implementation for Linux, another for Mac, etc.

An example of a framework would be Unity3D, which offers a set of tools that facilitate the development of video games.

answered by 10.09.2016 / 11:12

Good, referring to the technical definitions, with that I do not think there are problems of answers, for the rest and if that could create confusion.

A library is a collection of objects and functions that serve a particular purpose.

A framework is a collection of patterns to help you build a web, app ...

A API is an interface for other programs to interact with your program without direct access.

In short, a library is like a complement, the framework is the skeleton and the API the part oriented towards the visual layer for interact with her.

answered by 10.09.2016 в 09:04