What is the difference between a framework and a library?
I always thought of a library as a set of objects and
Your interpretation sounds pretty good to me... A library could be anything that's compiled and self-contained for re-use in other code, there's literally no restriction on its content.
A framework on the other hand is expected to have a range of facilities for use in some specific arena of application development, just like your example, MVC.
A framework can be made out of different libraries. Let's take an example.
Let's say you want to cook a fish curry. Then you need ingredients like oil, spices and other utilities. You also need fish which is your base to prepare your dish on (This is data of your application). all ingredients together called a framework. Now you gonna use them one by one or in combination to make your fish curry which is your final product. Compare that with a web framework which is made out of underscore.js, bootstrap.css, bootstrap.js, fontawesome, AngularJS etc. For an example, Twitter Bootstrap v.35.
Now, if you consider only one ingredient, like say oil. You can't use any oil you want because then it will ruin your fish (data). You can only use Olive Oil. Compare that with underscore.js. Now what brand of oil you want to use is up to you. Some dish was made with American Olive Oil (underscore.js) or Indian Olive Oil (lodash.js). This will only change taste of your application. Since they serve almost same purpose, their use depends on the developer's preference and they are easily replaceable.
Framework : A collection of libraries which provide unique properties and behavior to your application. (All ingredients)
Library : A well defined set of instructions which provide unique properties and behavior to your data. (Oil on Fish)
Plugin : A utility build for a library (ui-router -> AngularJS) or many libraries in combination (date-picker -> bootstrap.css + jQuery) without which your plugin might now work as expected.
P.S. AngularJS is a MVC framework but a JavaScript library. Because I believe Library extends default behavior of native technology (JavaScript in this case).
As I've always described it:
A Library is a tool.
A Framework is a way of life.
A library you can use whatever tiny part helps you. A Framework you must commit your entire project to.
I think you pinned down quite well the difference: the framework provides a frame in which we do our work... Somehow, it is more "constraining" than a simple library.
The framework is also supposed to add consistency to a set of libraries.
I don´t remember the source of this answer (I guess I found it in a .ppt in the internet), but the answer is quite simple.
A Library and a Framework are a set of classes, modules and/or code (depending of the programing language) that can be used in your applications and helps you to solve an especific "problem".
That problem can be log or debuging info in an application, draw charts, create an specific file format (html, pdf, xls), connect to a data base, create a part of an application or a complete application or a code applied to a Design Pattern.
You can have a Framework or a Library to solve all these problems and many more, normaly the frameworks helps you to solve more complex or bigger problems, but that a consecuence of their main difference, not a main definition for both.
The main difference betwen a Library and a Framework is the dependency betwen their own code, in oder words to use a Framework you need to use almost all the classes, modules or code in the FW, but to use a Library you can use one or few classes, modules or code in the lib in your own application
This means that if a Framework has, for example has 50 classes in order to use the framework in an app you need to use, let said, 10-15 or more classes in your code, because that is how is designed a Framework, some classes (objects of that classes) are inputs/parameters for methods in other classes in the framework. See the .NET framework, Spring, or any MVC framework.
But for example a log library, you can just use a Log class in your code, and helps you to solve the "logging problem", that doesn´t mean that the log library doesn't have more classes in his code, like classes to handle files, handle screen outputs, or even data bases, but you never touch/use that classes in your code, and that is the reason of why is a library and not a framework.
And also there are more categories than Frameworks and Libraries, but that is off topic.
A library performs specific, well-defined operations.
A framework is a skeleton where the application defines the "meat" of the operation by filling out the skeleton. The skeleton still has code to link up the parts but the most important work is done by the application.
Examples of libraries: Network protocols, compression, image manipulation, string utilities, regular expression evaluation, math. Operations are self-contained.
Examples of frameworks: Web application system, Plug-in manager, GUI system. The framework defines the concept but the application defines the fundamental functionality that end-users care about.