Concept: Inversion of Control

What is the difference between a Framework, a Toolkit and a Library? The most important difference, and in fact the defining difference between a library and a framework is Inversion of Control.

What does this mean? Well, 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. If it doesn’t have Inversion of Control, it’s not a framework. (I’m looking at you, .NET!)

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 on the other hand is a collection of functionality that you can call.

I don’t know if the term toolkit is really well defined. Just the word “kit” seems to suggest some kind of modularity, i.e. a set of independent libraries that you can pick and choose from. What, then, makes a toolkit different from just a bunch of independent libraries? Integration: if you just have a bunch of independent libraries, there is no guarantee that they will work well together, whereas the libraries in a toolkit have been designed to work well together – you just don’t have to use all of them.

But that’s really just my interpretation of the term. Unlike library and framework, which are well-defined, I don’t think that there is a widely accepted definition of toolkit.

Source: StackOverflow