10

My question is very simple, and I want a clear answer with a simple example.

What's the main difference between API, Toolkit, Framework, and Library?

dymanoid
  • 13,597
  • 3
  • 34
  • 59
Azzurrio
  • 1,503
  • 1
  • 17
  • 32

3 Answers3

6

This has always been my understanding, you will no doubt see differing opinions on the subject:

API (Application Programming Interface) - Allows you to use code in an already functional application in a stand-alone fasion.

Framework - Code that gives you base classes and interfaces for a certain task/application type, usually in the form of a design pattern. (Though not always)

Library - Related code that can be swapped in and out at will to accomplish tasks at a class level

Toolkit - Related code that can be used to accomplish tasks at a component level.

Ryan Bennett
  • 3,361
  • 17
  • 32
6

I prefer following:

  1. An API is an abstract description of how to use an application. For example, an API may describe the function syntax (declaration) of a chat server. i.e. login, publish_message, subscribe_messages. And, it describes any protocols to use the application. i.e. must login before sending or recieving messages, or clients are dropped after 2 minutes if not sending or receiving messages.
  2. A library is an implementation of an API, it containes the compiled code that implements the functions and protocols (maintains usage state).
  3. A toolkit is a set of libraries (API) and services grouped together to provide the developer with a wider range of possible solutions. For example, the Globus Toolkit provides services (such as File transfering, Job Subission and Scheduling) that a devleoper can install and start on their servers. They also provide API's to build applications that may use the services deployed in an integrated fashion. For example, the developer may build a program that uses the Job Submission API to communicate with the Job Submission Service.
  4. A Framework is a set of guidelines that prevents inappropriate use or developement. The developer must contruct their applications within the rules and boundaries of the framework. This is done by forcing the developer to extend the current framework to develope new software. by extending the framework, you force adhearence to the framework.

I'm not saying these are completely correct, but its worked ok for me so far!

Ron
  • 61
  • 1
  • 1
0

Those terms sometimes are misinterchanged.

Similar posts, read:

What is the major difference between a framework and a toolkit?

Framework vs. Toolkit vs. Library

I prefer to call a library as an alias of module or namespace. Toolkit and A.P.I. is usually a set of libraries for a common task. Altought, A.P.I. is more used for Procedural Programming than Object Oriented Programming.

Community
  • 1
  • 1
umlcat
  • 3,978
  • 3
  • 17
  • 28