Friday, May 25, 2012

Knockout.js vs Backbone.js (vs ?)


I'm a long-time developer who's getting more and more into in-browser development. (The modern tools are awesome!) I need to build some bigger, longer-running client-side interactions to go with my server-side stuff.



Is it worth adopting a framework like Knockout or Backbone to speed things along and keep things organized? If so, how should I go about choosing between the two? And are there other options worth looking at?


Source: Tips4all

1 comment:

  1. I have looked into both knockout.js and backbone.js and my opinion is that both are quite good.

    knockout.js

    pros


    Easy to setup. For Visual Studio 2010 you can use Nuget.
    The number of lines of Javascript you have to write is very small.
    Once you have setup the correct binding everything just works because of two way binding.


    cons


    Data-binding is mixed with html elements.*
    Figuring out complex UI interaction is not straight forward.


    *Some consider this to be neutral, or even a pro, because it is an easy way to reference quickly where exactly data is being bound. It is also possible to use knockout without mixing data-bind in HTML elements.

    backbone.js

    pros


    Highly flexible. You can choose not to implement some features (e.g Controller) based on your requirement.
    It is tightly integrated with underscore.js which is great.
    Initially you have to write more JavaScript code but it's very easy to implement complex user interaction.


    cons


    Designed more towards consuming REST data.
    More complex initially if compared to knockout.js.

    ReplyDelete