my goal is to migrate an existing web application to a RESTful SPA (single page application).
My requirements are as follow:
- RESTful data layer (like ember-data)
- Dynamic routes
- Coding by convention
- good (API-) documentation
- living community
The current application is using backbone.js. All in all backbone.js is a nice project. But I’m missing well defined structures that determine where what has to happen and how things must get implemented. Working in a bigger team with changing developers this leads to some kind of unstructured code, difficult to maintenance and difficult to understand.
This is why I’m searching now for a framework, that already defines all this stuff.
I looked into ember.js the last days. The approach seems very promising to me. But, unfortunately, the code changes almost daily. So I won’t call it production-ready. And we can’t wait for it to be version 1.0 – unfortunately. But I really like the idea behind this framework.
Angular.js is a widely spreaded framework as well, maintained by google. But I could not get familiar with angular. For me the structure seems kind of unclear, explanations are missing of the overall responsibilites of each part of the framework, and the implementations feel circuitous.
Just to get this straight: this is just my personal impression and might be based on missing knowledge.
As I understood both frameworks need a server part as well. And since we just want a RESTful backend – no matter what language, technic or software, this is not what we want. Further the backend API does already exist (RoR).
I did not go any deeper in these three candidates. Maybe this will be my next step.
So my questions now:
- Am I missing any good SPA-frameworks?
- What framework would you suggest/recommend?
- Would you avoid any of the mentioned frameworks?
- What is your experience in bigger SP applications?
PS: Yes, I know there are already some question on SO. But since the development is so rapidly and fast for SPAs, most of them are already out-of-date.
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.
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
.parsemethods 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.
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
data-bindattribute 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 KnockBack which combines both frameworks.
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.
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.
As I mentioned, we ended up using Knockout because, for our project, focusing on view binding was more important. We also ended up using RequireJS for modularization, crossroads and Hasher to handle routing and history, Jasmine for testing, as well as JQuery, Twitter Bootstrap, and Underscore.js (and probably more libraries I’m forgetting at the moment).
and after a lot of researches we ended up using Dojo framework .
main features you’ll love:
- educated community and a team that came up with a perfect design pattern. great conventions and modular/object-oriented architecture. with CrossBrowser programming attitudes 🙂
- build classes with inheritance. property setters, a lot of function tools.
- pub/sub mechanism (named topics in dojo)
- a lot of UI controls, from validation form control, dialogs/tooltips to a heavy featured, highly customizable (but lightweight) chart & data-grid solution.
- a good unit test system named DOH. it also have a robot to reproduce mouse/keyboard actions.
- a querying tool (like JQuery) named NodeList with all jquery features and even a lot of it’s plugins.
- and the good but not so complete part. it has a JsonRest module to use with your REST services. its a handy tool but it lacks a lot of features.
to overcome these issues, we developed an AJAX poller, error handling and universal, loading & notifications solution.
we did it very easily using dojo framework conventions and structures.
if you don’t want to do that, perhaps you have to use another framework for this part.