views:

81

answers:

4

Possible Duplicate:
Framework Vs. API

What is the difference between an API and a framework in Java? I mean the things a developer must be clear about. Can you share some article or case-study document?

+1  A: 

An API is a set of methods/classes you can call from your code. A framework is the actual code which will do exactly what you want.

You can see things like this :

  • API are the interfaces, public documented methods that anyone can call without knowing the code behind all of this.
  • Framework are the actual implementations of these interfaces (the code)

Most of the time frameworks come with their own interfaces, so there is only one implementation.


Resources :

On the same topic :

Colin Hebert
Nice answer, but you don't mention the main thing that makes a framework a framework as opposed to a toolkit or library (quote from the first SO question you linked to): "The distinguishing feature between a class library and a software framework is that in a framework, the flow of control is not determined by the user´s code, but by the framework."
teukkam
+1  A: 

Any framework provides an API which exposes the funtionality to a developer. The framework itself is the implementation of this functionality (which usually hidden) and is only accessible through the API methods. This separation is important for further extensions of the framework, since older coder which alrady uses a framework isn't broken when the framework is extended while maintaining compatibility to the previous API:

stacker
A: 

API is a abbreviation for Application Programming Interface. Thus API is a technical view.

"Framework" can be a lot more than just code. It includes concepts, designs and code.

Christian Strempfer