What is a Framework?
The title question made me struggle for months.
- What is a framework?
- What is the difference between a library and a framework?
- If I use a framework as a library, does it make it a library?
- Is Rails a framework?
- Is Backbone a framework?
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)
Tags:






Comments
Mason Mann replied on Thu, 2012/12/13 - 6:46am
Uh, why struggle for months when the first google hit answers it with nice concensus amongst IT professionals:
http://stackoverflow.com/questions/3057526/framework-vs-toolkit-vs-library
Mason Mann replied on Thu, 2012/12/13 - 6:01am
So to expand on the answer:
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.
See above.
Makes no sense. See above.
Yes.
Yes.
Bruce Wallace replied on Thu, 2012/12/13 - 8:58pm
I used to tell people that a library was a collection of bricks (of functionality), and a framework was a swiss cheese where you filled in the holes (with your own functionality). [You used to write programs that called prewritten library routines, now frameworks are the prewritten programs that expect you to write the library routines that they will call.]
These days I use the analogy of a circuit board, where the sockets on the board define the components to be used (and you create your own chips that meet the interface and functionality specifications).
This leads to my article about there being no such thing as a component in the same way that there is no such thing as a donut hole...without the donut to define it, there is no hole, and without a framework to define it, there is no component...
http://www.existentialprogramming.com/2010/05/hole-for-every-component-and-every.html