Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Framework Vs. API

Tags:

frameworks

api

Now, this may be a silly question but sometimes the terms Framework and API are used interchangeably. The way I see it is that a Framework is a bigger more generic thing, containing many API's, that could be used for various programming tasks (for example, the .NET Framework.) An API is smaller and more specialized (for example, the Facebook API.) Anyone want to share their insights on the matter?

And take for instance that Microsoft call .NET a Framework whereas Sun calls theirs a Platform ... so could it be also a business/marketing decision as to how call a "collection of libraries."?

like image 736
jasonco Avatar asked Apr 07 '09 06:04

jasonco


People also ask

What is difference between framework and API?

A framework is a group of classes, interfaces and other pre-compiled code upon which or by the use of which applications can be built. The API is the public face of a framework. A well designed framework only exposes those classes, interfaces, etc that are needed to use the framework.

Is a Web framework an API?

Web API is an API as the name suggests, it can be accessed over the web using the HTTP protocol. It is a framework that helps you to create and develop HTTP based RESTFUL services. The web API can be developed by using different technologies such as java, ASP.NET, etc.

Is API a library or framework?

An API is just a definition of a bunch of function you can call, and is a part of both libraries and frameworks.

What's an API framework?

API frameworks are code libraries that provide commonly-used functionality when building your own web application programming interfaces (APIs).


1 Answers

Design Patterns provide the following definitions:

  • toolkits: "often an application will incorporate classes from one or more libraries of predefined classes called toolkits. A toolkit is a set of related and reusable classes designed to provide useful, general-purpose functionality".
  • frameworks: "a framework is a set of cooperating classes that make up a reusable design for a specific class of software".

The key here is that while toolkits (APIs) can be useful in many domains, frameworks are geared to solve issues for specific classes of problems, that can be customized "by creating application specific subclasses of abstract classes of the framework".

Moreover, and maybe more importantly, "the framework dictates the architecture of your application": Inversion Of Control is one of the characteristics of frameworks (see Martin Fowler on this); instead of having your application call specific APIs to implement a specific behavior, it's the framework that calls your code.

like image 188
Stefano Ricciardi Avatar answered Sep 28 '22 23:09

Stefano Ricciardi