What is the difference between an API , framework and middleware? What is the difference between an API , framework and middleware? windows windows

What is the difference between an API , framework and middleware?


An API is an Application Programmer Interface. Its just a term that refers to the methods a programmer will use to interface with the software. For example, a DAO might have a save() method. Save is part of the DAO API. At a high level, you might have an Add User to System functionality. Thats part of the system API.

A framework is a tool or set of tools. For example, Spring is a framework that manages your inversion of control, dependency injection, and provides nifty templates to make your life easier. You use Spring via its API.

Middleware is software that allows a bunch of isolated systems or functionalities to interact. So if you have a website, and a payment system, you use middleware to hookem up.


An API is an interface to a programming library (or libraries). It doesn't impose on you a way of doing anything. E.g. OpenGL doesn't restrict what you can do with it.

A framework supplies you with part finished solution to a problem. You fill in the blanks to make what you want. This might accelerate what you are doing, but you are also limited by the limitations of the framework, e.g. design, performance, functionality. -- E.g. MFC provided a way of creating UIs. It supported dialogs well, but not forms, and things like docking were limited and contained bugs. Windows Forms is a much more capable framework (from the architect of Borland Delphi!) which is better in every way: design, flexiblitiy, tools, etc. Frameworks are great until they don't do something you want them to do and then you may lose most of the time you gained trying to work around them.

Middleware is a vertical slice. If you think of software as layered (E.g. OS, hardware abstractions, utility libraries, etc), middleware incorporartes many of these layers vertically. It provides a full, or partial, solution to an area within your application. E.g. a brokered messaging system, or a rendering library/engine. Middleware supplies more than just the basic library, it also supplies associated tools like logging, debugging and performance measurement. One thing you have to be careful about when using middleware is the DRY principle. Because middleware is vertical system, it may compete or duplicate other parts of your application.


A framework implements an API. The API isolates framework clients from the implementation details of the underlying framework. Thus (broadly speaking) you can use Mono or .Net Framework to run a program based on common source code, because the API to either framework is the same.

Middleware is typically a framework specialized for interprocess communication.