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:

Vladimir E said...

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.

Vladimir E said...

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

Andrzej Krzywda said...

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

Vladimir E said...

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..."

Blacktiger said...

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.

Unknown said...
This comment has been removed by the author.
Unknown said...

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.

Unknown said...

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 :)

Tartley said...

I framework is a library with a bad API.

Unknown said...

@Tartley so true :)

Anonymous said...

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

Unknown said...

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.