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 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 specific 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, see the FAQ for guidance.
|
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. |
|||||||||||||
|
|
Good answers so far but they miss one key point - a framework uses IoC. Your code is surrounded by a framework. It lives inside it. In contrast, your code just uses a library or API. It lives outside it. IoC is the difference. |
|||||||
|
|
A framework is a step up from library. If your toolbox is a library then your workshop would be a framework. Wikipedia says
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) |
|||
|
|
|
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. |
|||
|
|
|
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. |
|||
|
|
|
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. |
|||
|
|
|
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 what we used to use years ago, it was dusty NAG library documentation in grey ring binders. Then we switched to PCs and Windows and had APIs, that was a lot more modern. Then with web2.0 we had Frameworks and patterns - much cooler. Can't wait to see what we get next - strange that the job hasn't changed? |
|||
|
|
|
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,
When a call comes in to your application
to the calling person reasons why these exist:
|
|||
|
|


