Turbolinks

What do people think about the turbolinks feature in the upcoming Rails 4 release? Has anyone done a comparison with something like Emberjs in both terms of performance and developer experience?

I’m pretty concerned about the potential for turbolinks to break a lot of the things we currently take for granted in the request/response cycle. It’s definitely going to be rough going for awhile until we ‘beta test’ all the bugs that will invariably crop up.

You can’t compare turbolinks and Ember.

Turbolinks and pjax were designed to give a performance boost AND keep the standard Rails development stack e.g. server-side rendering of views.
Ember is designed to remove this server-side generation of views / forms and treat the server as nothing more than a JSON API.

There are times when both approaches make sense but more often than not I feel that server-side rendering is superior, in development experience, testability, stability, routing, SEO. Server-side rendering of views is much simpler, faster to develop etc… The only benefits of doing everything on the client is a theoretical speed boost. To me, that’s not worth the problems you encounter with it.

I’m not completely opposed to client-side heavy applications, I feel that a framework like ember shouldn’t encompass the whole app though, save the client-side complexity for when it’s really required and only introduce it when there’s something when the server-side development wouldn’t suit.

I don’t think it’s off base to compare the two. Both are solutions to the problem. They just fall on different sides of what should be the most important focus in an ideal solution. Rails, and it appears you, think that server-side rendering has so many advantages that it’s not worth adopting considering rich-client apps. If that’s your take, I agree, turbolinks might be a good way to continue building apps how you’re used to and still get some perceived performance boost on your client-side. I’m just curious how close it gets compared to something like Emberjs where the server is really treated just as a persistence layer.

I highly recommend watching this to the end.

I’m not against client-side frameworks like Backbone and Ember and actually use Backbone quite a lot.
I do try to caution people though, Javascript heavy apps get complicated fast no matter how well you structure things - my advice is always to write as little as possible and to keep your js as simple as possible.

It is entirely possible to build fast responsive apps using the standard rails stack without Node.js, client-side MVC or NoSQL :slight_smile:
By all means you should learn how to use client-side MVC frameworks to know their strengths and weaknesses, it’s the weaknesses I’m trying to highlight here.