Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I recently had to decide on a JavaScript SPA framework on a project too.</p> <ul> <li><p><a href="http://emberjs.com/">Ember</a> </p> <p>Looked at Ember early on and had similar thoughts as you about it - I really liked it but it felt like it was still too early to use... about half the tutorials I read didn't work with the current version because something had recently changed in how templating works.</p></li> <li><p><a href="http://backbonejs.org/">Backbone</a></p> <p>Backbone was the first frameworks we seriously looked at. I'm not sure I understand why you think it doesn't have "well defined structures"? Backbone is pretty clear about how to divide up Model and View code. Maybe you mean there's not some kind of app template? Anyway, Backbone seems really focused on the model/REST-binding part, but doesn't really prescribe anything for view binding. If model binding's important to you and you're using Rails it should be a breeze to do this. Unfortunately, the web services for my app didn't really match up, and I had to write my own <code>.sync</code> and <code>.parse</code> methods for everything. The separation of Model and View code was nice, but since we'd have to write all our bindings from scratch it wasn't worth it.</p></li> <li><p><a href="http://knockoutjs.com/">Knockout</a></p> <p>Knockout is like the Yin to Backbone's Yang. Where Backbone is focused on the Model, Knockout is a MVVM framework and is focused on the View. It has <code>observable</code> wrappers for JavaScript object properties and uses a <code>data-bind</code> attribute to bind properties to your HTML. In the end we went with Knockout since view binding was mainly what we needed for our app. (...plus others, as discussed later...) If you like Knockout's view binding and Backbone's model bindings there's also <a href="http://kmalakoff.github.com/knockback/">KnockBack</a> which combines both frameworks.</p></li> <li><p><a href="http://angularjs.org/">Angular</a></p> <p>Looked at this after Knockout - unfortunately we all seemed pretty happy with how Knockout did view binding. It seemed a lot more complex and harder to get into than Knockout. And it uses a bunch of custom HTML attributes to do bindings, which I'm not sure I like... I may take another look at Angular later, because since I've come across multiple people who really like the framework - maybe we just looked at it too late for this project.</p></li> <li><p><a href="http://batmanjs.org/">Batman</a>, <a href="http://meteor.com/">Meteor</a>, <a href="http://canjs.us/">CanJS</a>, <a href="http://spinejs.com/">Spine</a></p> <p>Didn't really look too closely at any of these. Though I know Spine is a similar framework to Backbone with explicit Controller objects, and is written in CoffeeScript.</p></li> <li><p>Afterword</p> <p>As I mentioned, we ended up using Knockout because, for our project, focusing on view binding was more important. We also ended up using <a href="http://requirejs.org/">RequireJS</a> for modularization, <a href="http://millermedeiros.github.com/crossroads.js/">crossroads</a> and <a href="https://github.com/millermedeiros/hasher/">Hasher</a> to handle routing and history, <a href="http://pivotal.github.com/jasmine/">Jasmine</a> for testing, as well as <a href="http://jquery.com/">JQuery</a>, <a href="http://twitter.github.com/bootstrap/">Twitter Bootstrap</a>, and <a href="http://underscorejs.org/">Underscore.js</a> (and probably more libraries I'm forgetting at the moment). </p> <p>Javascript app development is more like the Java ecosystem than the Rails ecosystem. Rails provides a solid core of stuff you're going to use for every app (Rails framework), and the community provides a lot of customizations on top of that (gems). Java provides... a language. And then you can choose Java EE or Spring or Play or Struts or Tapestry. And choose JDBC or Hibernate or TopLink or Ibatis to talk to the database. And then you can use Ant or Maven or Gradle to build it. And choose Tomcat or Jetty or JBoss or WebLogin to run it in. So there's more emphasis on choosing what you need and what works together than choosing <em>THE</em> framework to use.</p></li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload