views:

374

answers:

3

Does a framework allow you to abstract generic code - but not in a complete way (Ex: Abstract a network connection - but not what you actually do with the data), and does not solve any particular common requirement whereas a toolkit has solutions to generic problems(Ex: Dialog box widget)?

Real world Example: Prototype is a "framework", but Dojo is a "toolkit".

So my question is, what is the criteria to call something a framework vs calling it a toolkit?

+6  A: 

Framework enforces some design pattern on the developer and give some tools for code generation. This sits well with my first sentence, as it generates code in a certain style/pattern.
Library gives you functionality for you to use as you wish. Like the stdio functions of C, Console of C#, The "built in" functions of PHP etc
You can regard a library as a kind of API

Itay Moav
a good framework will not prevent the developer from using any design pattern she choses.
Here Be Wolves
btw, +1 .
Here Be Wolves
+1, Thanks for your explanation.
Thiyagaraj
+4  A: 

In my book, a framework provides a structure and encourages or requires that it be used in a certain way. This can be good if the developer wants to do things the framework's way, since it's easier for many thing to be automatic, but it can be bad if the developer wants to deviate from the framework's intent.

A toolkit, on the other hand, provides various tools that can be used together or separately. It's more flexible but requires more effort on the programmer's behalf.

Adam Crume
+1, This was very similar to the top-voted answer, so I marked that as the accepted answer and upvoted this, Thanks for your time.
Thiyagaraj
+3  A: 

Quoting Martin Folwer in his article on Inversion of Control:

Inversion of Control is a key part of what makes a framework different to a library. A library is essentially a set of functions that you can call, these days usually organized into classes. Each call does some work and returns control to the client.

A framework embodies some abstract design, with more behavior built in. In order to use it you need to insert your behavior into various places in the framework either by subclassing or by plugging in your own classes. The framework's code then calls your code at these points.

So in short, the big difference is that your code calls a library while a framework calls your code.

Pascal Thivent