Java API vs Framework
What is the difference between a Java Library and a framework? The two concepts are essentially important for a Java developer.
The most important difference between a library and a framework is Inversion of Control. It means that when you call a library you are in control. But with a framework, the control is inverted: the framework calls you. (This is called the Hollywood Principle: Don’t call Us, We’ll call You.)
This is pretty much the definition of a framework. Basically, all the control flow is already in the framework, and there’s just a bunch of predefined white spots that you can fill out with your code.
A library is a collection of class definitions. The reason behind is simple, i.e. get the code that has already been written by other developers. The classes and methods normally define specific operations in a certain area. For example, there are some libraries of mathematics which can let developer just call the function without redo the implementation of how an algorithm works.
A framework is normally more complex. It is a skeleton where the application defines the “meat” of the operation by filling out the skeleton. The skeleton has code to link up the parts(e.g. define work flow), but the different requirements implementation is done by the application. The benefit is that programmers do not need to worry about if a design is good or not, but just about implementing domain specific functions.
Both of them defined API, which is used for programmers to use.
To put those together, we can think of a library as a certain function of an application, a framework as the skeleton of the application, and an API is connector to put those together.
A typical development process normally start with a framework, and fill out functions defined in libraries through API.
Is this car fully tested? Or is it doing the Ice Bucket Challenge for ALS?