Ask HN: AngularJS vs Backbone vs Ember?
Hi guys,
I'm starting a new project and am wondering what are the pros and cons of each framework over the other?
Thanks!
I'm starting a new project and am wondering what are the pros and cons of each framework over the other?
Thanks!
22 comments
[ 3.4 ms ] story [ 56.1 ms ] threadI was reading through AngularJS and was utterly confused - it sounds a bit too complexed for my needs at the moment.
One of the design goals of AngularJS is to be as close to HTML and browser as possible - picking the good parts and enhancing it for building web applications.
Not digging against you, but this might (though, imho it shouldn't) be a barrier to entry to newcomers. I've simply resigned myself to editing the one line it takes to complete the tutorial every step of the way... Though in retrospect I think I probably could have just forked it and updated that line myself for a permanent fix... :)
I thought the documentation is pretty excellent. The tutorial did help with some of the concepts but it could be that my project requirements are different and so I didn't find it entirely helpful :)
That said, I found the cookbook to be helpful although it seems like it's not linked anywhere from the homepage?
Haven't used ember, but I do mancrush ykatz, so sure he is taking it to good places.
Backbone comes with a lot of boilerplate, but honestly is worth it if you have a larger front end app. Being able to have your data trickle though your models and views in a concise structured way can make changes as well as fixes much easier in the long run. Backbone's persistence functionality is pretty phenomenal as well.
Ember relies pretty heavily on Handlebars. If you're game to use that for your client side rendering than it could be a good option. Ember looks similar to Backbone but makes a few things easier such as computed properties and bidirectional bindings. I haven't touched it much yet as I'm currently working in Backbone and Ember's current lack of an "official" persistence mechanism turned me off a bit.
All three of these are great frameworks. Angular is easier to pick up but Backbone has more users and more users means someone has probably ran into a problem that you possibly will and has already asked a question on StackOverflow. That alone can be invaluable.
Backbone is a very light MVC framework that provides you a few minimal tools for structuring your project. It doesn't get in your way, and it won't have any performance issues. On the other hand, it doesn't hold your hand, and it doesn't help you solve any especially hard problems. A simple demo app tends to look very clean when implemented in Backbone, but anything more complicated will require you to write a TON of code. (By design; Backbone only provides functionality that everyone will need, regardless of the type of project.)
The other two you listed are heavier, and more opinionated. They will do a lot more to help you, if you're working the way they think you'll work. If you aren't, they can be counter-productive; it's not hard to miscode something to get a major performance penalty.
I evaluated every framework I could get my hands on, and settled on Knockout. It's quite similar to AngularJS and Ember, but feels more mature than either, and has great documentation. Its killer feature is it's two way bindings between the DOM and the JS models.
My project is basically a very complex CRUD app; I've got tons of complex, deeply nested records I need to display and let users edit; a good, fast, clean UI for doing so is crucial. My initial spike using Backbone bogged down in endless boilerplate to try and keep everything in sync, and tons of ugly JQuery code to manipulate the DOM. (And was buggy to boot, which I'm sure was my fault, but highlights that Backbone can have a somewhat rough learning curve.) Knockout, however, made it a snap. My code was shorter, cleaner, easier to write and maintain, and fast.
So, my suggestion: Backbone if you're comfortable with writing all the functionality you need from scratch, and just want a little structure for your app. On the other hand, if you want a very robust framework for writing CRUD apps with a rich UI, and want to make your life easy, go with Knockout.
(Ember and Angular are good too, but in my view they're too similar to Knockout. There's just no compelling reason to choose them, given that Knockout is more mature and polished.)
Also in contract to KnockoutJS, AngularJS doesn't require any special wrappers for your model (no ko.observable() all over the place), which means that it's less intrusive and allows you to create models the way you want them to be (need a native array, primitive or custom type? no problem).
As a side project, I might attempt to work with the other frameworks as a comparison.