Andrzej is a DZone MVB and is not an employee of DZone and has posted 24 posts at DZone. View Full User Profile

What is a Framework?

12.13.2012
| 19941 views |
  • submit to reddit

The title question made me struggle for months.

  1. What is a framework?
  2. What is the difference between a library and a framework?
  3. If I use a framework as a library, does it make it a library?
  4. Is Rails a framework?
  5. Is Backbone a framework?
Can you help me with your answers?
Published at DZone with permission of Andrzej Krzywda, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

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:


  1. What is a framework?

    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.

  2. What is the difference between a library and a framework?

    See above.

  3. If I use a framework as a library, does it make it a library?

    Makes no sense. See above.

  4. Is Rails a framework?

    Yes.

  5. Is Backbone a framework?

    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 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.