Saturday, February 12, 2011

Difference between framework and API

Yes, I think, for first time, it sounds baffling since many programmers may not care about the differences they just go on using frameworks and API's and becomes happy with the facilities provided by them for faster development of the software. Certainly, you may not notice because these are the stuffs which contains class libraries intended to interface with our applications(framework: higher level, API:lower level).

But, lets think these terms once and try to find out some differences between them.

1) Size

One dominant difference is the size. The framework resides higher levels which is oriented to the application tasks and so it is suitable for application development in higher level. But API is small and contains methods, libraries for specific purpose, and it does not cover all the stuffs required to develop an application, so we may need multiple APIs.

2) Level
The frameworks internally use APIs to work e.g. .NET framework uses the Win32 API to communicate with windows operating system. Thus, we can say API resides in the framework. The frameworks, because they resides higher level, make the user easier to develop the application without worrying about internal details of platform or machine configuration. The frameworks manage these things. But it is not complete, sometimes we need to change the settings in our own way, then it is necessary to program in API level where we can do lower level tasks for complex applications. So, for general applications, it is good to select framework, but for specific application, framework may not be boon, so go for API level programming.

The frameworks generally hides the API level methods and classes by wrapping it with framework higher level methods. Thus, frameworks support fast development of scalable applications. Frameworks generally cover all the things that require to develop an application from starting level to deployment level like compiling, managing source code, testing, support for IDE and deployment.

3) Examples
Frameworks: .NET framework, Ruby on Rails, Spring

Thats all.....