Saturday, October 8, 2011

Comparison of Knockout.js and Backbone.js

Knockout.js is a great micro javascript library that allows you to make MVVM style applications with Javascript. To learn more about knockout.js check out there awesome live (in the browser tutorial) at :
http://learn.knockoutjs.com/


But enough about what is Knockout. Lets move on the how cool is knockout. A sample TODOs was provided by Scott Messinger about how cool Knockout.js is as compared to Backbone.js.

In backbone.js :

And in Knockout.js:

Enjoy!

2 comments:

  1. Comparing two libraries on the basis of no. of lines isn't valid I think. Knockout and Backbone target two different problems altogether. Backbone is an MVC framework while Knockout is MVVM framework.

    ReplyDelete
  2. A completely unfair comparison.

    - the backbone example is full of multi-line comments and blank lines, the Knockout has zero comments, and is densely compacted to look small.
    - The backbone example uses HTML 5 local storage for persistence, the knockout example is basically a stateless webpage - click refresh and everything is gone
    - Backbone example has tooltips, editing items, statistics, xss protection... Knockout example has add & delete only.
    - The backbone code is the solution in its entirity, the knockout code is missing its HTML-embedded spaghetti pseudo-code

    ReplyDelete