Ember 2.0 moving away from controllers?


#1

I heard at the latest Boston ember meetup that the Ember 2.0 effort is moving away from classes like arrayController and objectController. I understand that these classes degrade performance compared to model.get(“property”). Is the trend away from controllers in general, or just away from these two proxy-like classes?


#2

Yes. The idea is that the route will some how instantiate a component instead of a controller, a view, and a template.

You can read more about it here https://github.com/emberjs/rfcs/pull/15 (skip to Routeable Components)


#3

So I owe an apology for not having dug into the RFC comments enough on this issue. I hope that having this thread might keep somebody else from making the same mistake.


#4

Hmm, Angular is moving away from controllers as well, going so far as to eliminate them in forthcoming Angular 2.0. Does the fact that two giant frameworks are moving away from controllers speak to a general shift in philosophy regarding front end MVC?


#5

I can’t speak for Angular, but in Ember this is mostly a shift in terminology. No longer relying on proxying is the biggest change, but all it means is that property paths have to include model. at the beginning—a pretty straightforward modification to make to your code.

Other than that, routable components are just controllers that also have access to their associated DOM element. We’ve spent a lot of time auditing the code in Skylight to prepare for this change, and in almost all cases the modifications necessary are tiny.

When making these design decisions, we looked carefully at our code, and only introduced changes we felt confident we could implement in one sprint. Because of that, I think of the changes in Ember 2.0 as refinements more than tectonic shifts in the programming model.