Thursday, December 6, 2012

What is a framework?

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?



12 comments:

  1. I think you are answering #1 and #2 by asking #3. "If I use a framework as a library" - aha! you know what Is what.

    ReplyDelete
  2. And I think that Backbone and Rails are frameworks, as they impose developer their way to handle things.

    ReplyDelete
  3. I think that Backbone doesn't call itself a framework? Does it make it a non-framework? ;)

    ReplyDelete
  4. Hmm.. You know, I found one of definitions - just replace "Backbone.js" with "framework" in the following sentence I got form backbone's site :)
    >"Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions..."

    ReplyDelete
  5. This is my favorite definition (not sure where I got it from):

    - A library is called by your code.
    - A framework calls your code.

    Of course, within a framework you will sometimes call parts of a framework. This means that a framework is a library, but a library is not necessarily a framework.

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. you use a library to do some work (to authenticate, to call a service, to parse, etc...)

    you use a framework to structure your app.

    ReplyDelete
  8. Frameworks kinda force developers to think and do stuff as framework creators would. It is a bad thing since it limits creators creativity, but its a good thing because it makes him extra productive.

    I am starting not to like rails because it imposes way to many things, and it makes it hard when you don't want to play by the rules :)

    ReplyDelete
  9. I framework is a library with a bad API.

    ReplyDelete
  10. In my humble opinion, a framework is a library + a set of conventions

    ReplyDelete
  11. In the case of a framework, your code is called by it. In the case of a library, your code call it. Rails is a framework, and provides libraries too.

    ReplyDelete