News for hackers. Stuff that matters.
Re:Why does Ember.js rock? by jcampbell1 on Saturday August 03, 2013 @10:29PM (#6154340)
I have nothing but praise for both Ember and Angular. Both give you real data binding, and delegation rather than events. Compared to Backbone, both are like being in heaven rather than the 4th level of "event" hell.

There are a lot of differences, but if I had to pick, it would depend on the application. If I was building something with complex front-end requirements where the vocabulary was mostly tabs/panes/switches/filter-dropdowns/etc., then I would go with Angular. If I were building something where the data domain was more important, e.g. the vocabulary is more about authors/titles/posts/tags/etc. then I'd go with Ember.

With Ember, persisting a complex model to a backend is a priority for the framework developers. With Angular, it is left as an exercise for the reader.

With Angular, extending the DOM to create new web components is a central focus, but with Ember, it is totally an after thought. Ember Components are a joke compared to Angular directives...

I was about to link to the Ember component source code showing how pointless they are. (A week ago they were useless) The devs have been furiously fixing Ember Components to have the power of Angular JS directives. I am so happy to see the good parts of Anular making their way into Ember. For those that hate Angular terminology, it appears 'isolate' has made its way to Ember. I hope 'transclusion' does as well. Need more than one way to {{yield}}

Re:Why does Ember.js rock? by djacobs on Sunday August 04, 2013 @03:19AM (#6154960)
I think it's important to remember that Backbone is not one library but a modular ecosystem. I am a huge fan of Backbone Marionette + Relational + ModelBinder as a very valid alternative to Ember and Angular.
Re:Why does Ember.js rock? by padolsey on Sunday August 04, 2013 @04:21AM (#6155039)
Even comparing Backbone (by itself) to these two is futile. It's thin, doesn't prescribe much, and doesn't even promise to offer what Emb/Ang do, so to compare them is unfair to all involved IMHO.

I'm reluctant to try something big with Angular because of its insistence on dirty checking, which just ends up being an annoyingly leaky abstraction half the time (see $timeout, for example).

Re:Why does Ember.js rock? by Nitramp on Sunday August 04, 2013 @10:48AM (#6155796)
I've written large applications in AngularJS, the dirty checking is generally not a problem. If you write complex directives that need to pass non-trivial data structures around, you have to know what you're doing, but it still works fine.

I don't get your reference to $timeout - $timeout is Angular's more testable wrapper around setTimeout for an asynchronous operation. AFAICT it's entirely unrelated to dirty checking - sometimes you just want something to happen later. Am I missing something?

Re:Why does Ember.js rock? by minznerjosh on Sunday August 04, 2013 @11:03AM (#6155842)
I think that one of the most important features of $timout is that it runs a digest cycle after the timeout completes. That's why bindings get updated when you modify data in a $timout callback. So it is related to dirty checking.
Re:Why does Ember.js rock? by cheapsteak on Sunday August 04, 2013 @02:13PM (#6156468)
You sound like you know your way around both frameworks.

How long would it take to learn both of them, if you're already familiar with Backbone?

Are there yet any comprehensive resources to learn either one, similar to Addy Osmani's Developing Backbone.js Applications book? The videos like Ember 101 and Egghead are nice, but I worry that they don't go deep enough.

Re:Why does Ember.js rock? by hackula1 on Sunday August 04, 2013 @05:50PM (#6157237)
Couple weeks each to get to the point where you can make a good decision. You could probably just choose one and go with it for low risk projects.
Re:Why does Ember.js rock? by agilebyte on Sunday August 04, 2013 @07:13AM (#6155293)
Once a project gets big I switch to the Publisher/Subscriber pattern through a main Mediator rather than using the default Model/Collection change events.

That is to say that I cannot relate to your 4th/any hell level.

Re:Why does Ember.js rock? by hackerboos on Sunday August 04, 2013 @07:37AM (#6155349)
Can you elaborate on this?
Re:Why does Ember.js rock? by agilebyte on Sunday August 04, 2013 @07:45AM (#6155361)
I would create a global mediator:

    export var mediator = _.extend({}, Backbone.Events);
And then use it to listen to messages in Views:

    m.mediator.on('change:page change:sort change:tags', this.renderTable, this);
And fire them from Models/Collections:

    m.mediator.trigger('change:sort', sortOrder);
Instead of listening to changes on them:

    this.paginator.bind('change', fn, this);
So I can plug & play different parts of the system together.

Edit: A link from Addy Osmani: http://addyosmani.com/largescalejavascript/#mediatorpattern

Re:Why does Ember.js rock? by steveklabnik on Sunday August 04, 2013 @10:25AM (#6155734)
Have you tried out functional reactive programming? How does it compare to the mediator?
Re:Why does Ember.js rock? by agilebyte on Sunday August 04, 2013 @11:11AM (#6155859)
You mean like Bacon.js? I have not, yet. Looking at it now it seems that it is used for filtering/mapping/combining values?

The messages I send are more light weight and usually say "this has happened" to which a View would respond by re-rendering itself or its part rather then me directly passing whole Models and Collections around.

Re:Why does Ember.js rock? by steveklabnik on Sunday August 04, 2013 @03:22PM (#6156739)
Yup! It sounds quite a bit like your mediator: make a stream, send events in the stream, certain things respond to the stream.

Check out this talk: http://vimeo.com/68987289