After reading your recent blog post about EmberJS, and given your experience with Backbone, I was wondering: which kind of apps do you consider a better fit for each framework?What kind of features, UIs, constraints, workflows, etc make more pleasant to develop with Backbone vs EmberJS? What criteria would you apply before deciding which framework to use in your next Rails + JS app?
Backbone and Ember cover completely different ranges of applications. Itās somewhat like comparing Rails to Sinatra, or even to Rack. Ember is a heavy weight framework thatās better suited towards large scale, complex, single page applications. Backbone is less a framework, and more a collection of ideas. Itās light weight, and applies more or less anywhere that jQuery applies. Using Ember for an application that will have only a little JavaScript would be like taking a sledgehammer to squash a mosquito. Similarly, if you end up trying to write a larger application in Backbone, youāll ultimately end up having to write your own framework around it.
I personally prefer Angular over Ember for larger applications. Iām not a fan of several of Emberās design decisions (it has its own object model, it monkey-patches Function#prototype, etc.), and several pieces of Angular (mainly how it handles templates) fits more nicely in the Rails stack.
I think that trying to think of ember as a single page app is the wrong frame of mind. One of the most powerful features about ember is itās router and use of the URL.
As the homepage states, its for building ambitious web applications. Like rails, itās opinionated and getting started can be frustrating. There is an Ember way to doing things and going against that leads to a lot of heartache later on in development. Thereās a steep learning curve, but there is gold at the end and I think itās worth working through.
Iāve been very happy with developing in Ember but it is by no means for adding a bit of javascript spice to your application. If your just looking at a small part of your application Angular, backbone or just jQuery are certainly better options.
Thank you both for your comments! I seeā¦ would you recommend Angular or EmberJS for an app where only some pages have JS-based UIs, or thatās a better fit for Backbone, even if those individual pages are highly interactive and stateful? How easy would be switching from a Backbone-based app to an EmberJS one? If youāre launching a prototype you know youāll be iterating a lot and donāt know what the app will end up looking likeā¦ In such cases I always feel comfortable with Rails in the server side, but Iām still kind of lost when it comes to choosing a client-side framework.
As an aside, what about testing ā have you noticed any major differences between both frameworks?
In the case of having a couple of pages that need the interactivity of a single page app I would say go with backbone or sprinkle a little jquery and stick with turbolinks.
I havenāt really used ember. When it hit 1.0 I played with it, got frustrated by the docs and gave up after an hour. I have been told that the situation has improved but havenāt yet gone back.
I work on a large enterprise rails project where we are using angular on some pages and it leans towards the ugly side of things. How it is being implemented using a simple ng-app is a no go. We have to manually bootstrap every section where we use it or it takes forever to load correctly. Also the actual angular.js javascript include canāt be included in the application.js file because it will parse the dom on every page using angular or not making the page feel sluggish.
Disabling prototype extensions is super easy (literally one line of code). The claim about Angular templates working with Rails better is new to me. Would you mind unpacking it? We definitely designed Ember to be a better fit for people that adopt the Rails worldview. Thanks!