What is the difference between a library, framework, and API? They all seem the same to me. I would like to hear peoples thought of this.
closed as not constructive by gnat, Kilian Foth, Martijn Pieters, Glenn Nelson, thorsten müller Feb 25 '13 at 12:52
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. If this question can be reworded to fit the rules in the help center, please edit the question.
locked by Thomas Owens♦ May 6 '15 at 8:58
This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: help center.
A library is a collection of functions / objects that serves one particular purpose. you could use a library in a variety of projects.
A framework is a collection of patterns and libraries to help with building an application.
An API is an interface for other programs to interact with your program without having direct access.
To put it another way, think of a library as an add-on / piece of an application , a framework as the skeleton of the application, and an API as an outward-facing part of said app.
A library is a collection of code built to perform common tasks. Library code tends to be relatively stable and bug free. Use of appropriate libraries can reduce the amount of code the need to be written. It will tend to reduce line of code counts for an application will increasing the rate at which functionality is delivered. In most cases, it is better to use a library routine than to write your own code.
An API (Application Programming Interface) is interface to some functionality which allows an application to access the available functionality. An API may be referred to as an Interface. API exist at many levels including system, library, framework, program, and application. APIs should be defined before the code implementing them is implemented.
APIs should be stable, although portions of the API can be deprecated for various reasons. The more broadly used the API the more difficult it is to change it. Most if not all of the Java 1.0 API is still available, although many methods are have been deprecated.
A Framework is a collection of APIs designed to make building of applications simpler. Frameworks provide implementations for reusable components. Good frameworks tend to be specialized in their application.
The Java Collections Framework is a collection of APIs to various types of objects that can be used to handle collections. It provides a hierarchy of APIs to various collections. The in the Java Collections Framework the SortedSet interface extends Set interface which in turn extends the Collection interface. These APIs are abstract interfaces, and the actual implementations have different names. The Collections Framework makes implementing collections simple, and simplifies changing implementations during development.
Frameworks can be built of smaller frameworks as is seen in the Java Spring Framework targeted at J2EE development. Spring consists of over a dozen frameworks, many of which can be used on their own or replaced by other frameworks.
Use of the appropriate libraries, APIs, and frameworks can simplify development. These components take care of the common issues, and allow the development team to focus on the application specific issues.
A framework is a step up from library. If your toolbox is a library then your workshop would be a framework.
An API is an abstraction that describes an interface for the interaction with a set of functions used by components of a software system
The important distinction between an API and a user interface is that an API lets other software/services interact with your solution programatically.
API's can be built both for applications (through dll's or plugins) or websites and services (through REST and webservices)
APIs define how to use something else in terms of what objects and methods can be used from a source. For example, integrating Twitter or Facebook into a site uses an API from Twitter or Facebook to ensure the proper data is updated.
Frameworks tend to be a bit bulkier in a sense as this can almost form its own language at times. jQuery being an example of a framework which has its own syntax and carries a bit more weight in terms of getting into my code in a sense. Frameworks can also be platforms that make them similar to APIs in a sense,e.g. the Win32API or .Net Framework each have numerous methods for building an application so there can be Frameworks that have APIs in them and APIs that are also viewed as Frameworks.
Libraries tend to be binary files that implement an API or Framework and so they are the bits that you have to have to use an API or Framework in some cases. At least that is how I see these terms and the differences among them.
Go to a library and start reading books. If you are the application then the collection of books is the library. The shelves, the cupboards, and the compound that houses all this constitutes the framework. Everything you come in contact while performing the task of reading the books is the API.
A library is a collection of code that is used to simplify common tasks - it can be classes, functions or whatever is specific to your language or platform. A good example might be a string manipulation library that provides helpers for common tasks (building, splitting, searching or sorting strings etc).
An API (application programming interface) is a definition ('interface') of how to work with another application, system or technology. It essentially defines the operations that are available to interact with that other system. An API can be a library (meaning that the API is wrapped in a library or set of classes), but the distinction is that an API always references an external system - whether it's a database, web service, another application, or the operating system itself.
A Framework is a larger concept - it will normally contain a number of libraries and APIs to perform common tasks. It exists on a higher conceptual level - it's not just a collection of tools, but also a collection of design patterns, best practices, and methodologies. A software Framework is an extension of a a general framework - its meanings include being a foundation from which things are built, providing support and structure, and giving guidance and definition to requirements.
The application is developed using libraries based upon a framework and communicates through a API.
If you building a app say a online image processing application,
- You can use some pre written image processing libraries.
- on any framework you know which will guide you to construct the application.
- You will be providing the application some way to interact with outside world..that would be your applications API to rest of the world.
When a call comes in to your application
- it would be handled in a way how you designed with guidance of framework
- processing the call carried by library
- these functions will be accessed through the your API from outside world
to the calling person
reasons why these exist:
- library : saves you from reinventing the wheel
- framework : saves you from unexpected traps of system design and handling unless the framework itself has flaw's
- API : ensures the security of application by interfacing the core from the real world access