Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BackboneJS vs JavaScriptMVC vs KnockoutJS [closed]

Tags:

I want to use a JavaScript framework for a complex web application. I have been looking at Backbone.js, knockout.js and JavaScriptMVC. Being pretty new to client side JavaScript heavy web apps, I'm not sure which one to pick. Each one has a pretty different approach to separate the concerns. Model/View/Controller vs Model/View/ViewModel vs Model/View/Collection.

What do you guys think? What are the deciding factors? Which one would be the easiest to pick up? What has your experience been like?

like image 352
Drew Avatar asked Mar 01 '11 01:03

Drew


People also ask

Do people still use KnockoutJS?

KnockoutJS is far from dead, and it's actually still being improved and evolved (see Technical Knockout) but newer frameworks seem a far better bet for our needs, considering activity and performance.

Do people still use Backbone JS?

Backbone. Backbone has been around for a long time, but it's still under steady and regular development. It's a good choice if you want a flexible JavaScript framework with a simple model for representing data and getting it into views.

Is KnockoutJS worth learning?

The good thing about knockout is that it's one of the few frameworks that works without any tooling and works on very old browsers. It was very popular with Asp.net websites for precisely this reason, easy to load, not that hard to learn, and not super opinionated.

Is KnockoutJS easy?

KnockoutJS library provides an easy and clean way to handle complex data-driven interfaces. One can create self-updating UIs for Javascript objects. It is pure JavaScript Library and works with any web framework. It's not a replacement of JQuery but can work as a supplement providing smart features.


2 Answers

You can't go wrong either way especially if you are building a complex javascript UI. If you choose not to use either, you will likely wind up with a lot of difficult to debug code. I personally like Backbone but they are both lightweight and allow you freedom in your templating language (I use JQuery templates). I think what made me choose Backbone was the way Knockout mixed its components in with your html:

<span data-bind="text: myItems().count"></span>

You may be able to avoid using constructs like the above with Knockout but that was enough to throw me toward Backbone. I also liked the fact that backbone has dependencies on both underscore and jquery which were already in use in my projects.

like image 54
AlexGad Avatar answered Sep 21 '22 18:09

AlexGad


To build on HostDude's comment - it's a feature, not a bug :) Part of the concept of knockout is that there's a layer inbetween your Controller/Model and the View. This lets us modularize our HTML into small components that include the data mapping.

So yes the JS bindings are mixed in, but they are not mixed into raw HTML - rather they are added to tiny modularized Jquery templates. By adding those data bindings in explicitly at the jQuery template level, we have total control over what's mapped to what -- without disturbing our underlying application data model at all :) I love Knockout!

like image 27
dylanized Avatar answered Sep 23 '22 18:09

dylanized