Monday, June 10, 2013

Framework vs. Library

From time to time, I'm wondering what's the different between framework and library in web development world, especially for Javascript frameworks and libraries:

And since recently I'm learning AngularJS (which is a JS framework, instead of just a library). And I just encountered a good explanation about the difference between framework and library from the farther of AngularJS, Miško Hevery, in his talking "Breaking Open: AngularJS".
In the framework world, the framework is in charge. It calls you when it sees necessary. You have to implement these hooks by which you get call at that point. And library is in the world the other way around. You are in full control, and you get to call the library whenever you feel like. Because the framework is the other way around, the framework has opinions. It gets to share the opinions with you, so you have to play along with the opinions the framework has. This is the simple trade you happen to have, which is that you can be more in general but do less, or you can do a lot more but you have to be opinionative, you have to do it in this particular way, or to play with the philosophies we happen to have.

2 comments: