In light of the recent JS testing video, I’m really curious what Thoughtbot (and everyone else) thinks about JS frameworks for complex UI. Thoughtbot’s been blogging about both and I’d love to hear any usecases that’ve been developed for choosing one over the other.
I’ve been trying to learn Angular for the past few months, just because it seems to be a bit more popular and documentation/tutorials are everywhere. That said, I had another look at Ember again last week and think I’ll be moving towards that soon because it seems to fix all the things I hate about angular: the limitations of ngRouter and all the boilerplate needed to hook into a Rails JSON backend (although Restangular seems to be fixing that). After writing a decent sized angular app, the ember homepage video reminded me of DHH’s rails intro video: ‘Look at all the stuff I’m not doing!’
After doing angular for a bit, I do find it more fun than jQuery and will probably continue to use it in cases when I just need to augment Rails’ views a little. edit: One of the other things I like about angular is ngAnimate and how easy it is to add obnoxious
Also – regardless of which JS frontend – do folks tend to embed the JS app into Rails’ views or separate the two? In my current project, I built the frontend into Rails.root/client and am using gulp to build it into the public directory, for no particular reason other than I wanted to get some experience with gulp and bower.
We’ve done projects in both Ember and Angular, and researched standardizing on one framework. However, at the end of the day we decided that each framework has it’s strengths, and that different developers preferred one over the other, and it didn’t seem like there was any big win to standardizing.
We felt like the structure and “convention over configuration” of Ember was a nice win for sites that make sense for the Ember structure and do not need to exist as part of a larger whole, or a larger ecosystem. Ember also works really well with Rails, technically and philosophically.
Angular tends to work better if you need to use it to enhance a component on a page or exist within a larger ecosystem. Or if you’re not using Rails as a backend.
Backbone was great when it was the only game in town, but it’s on likely that we would use it for a new project that actually would benefit from a javascript framework.
I dabbled a bit in Backbone and React myself. I can’t really get myself into these frameworks just yet, maybe it just hasn’t clicked yet, or maybe it’s partly my own inexperience with JavaScript. But implementing something as simple as breadcrumbs takes me hours to do in Backbone, where it’s a five minute job on Rails. I think I’m going to give Ember a shot, as it seems to coincide more with some of the Ruby/Rails way of doing things.
Plus the way routing works in these frameworks is a HUGE turnoff. The history API supposedly solves a lot of the problems and makes it more consistent with the way a server side web application would behave, but from what I hear that has pretty shoddy support for some of the older browsers.
I haven’t worked too much with javascript frameworks myself, but I’ve been looking into them, reading tutorials and trying to get simple stuff up and running.
However, whereas Backbone, Angular and Ember have a pretty steep learning curve (in my opinion), I found Spine.js to be a lot easier to learn. I don’t know if this is because the framework is simpler or because the documentation and tutorials were better, but I felt like I grasped it a lot quicker. It was also pretty easy to integrate with rails using the spine-rails gem.
The downside to spine.js however is that it’s mostly unknown and so the community is smaller than the other frameworks.
And I would probably go with a more well-known framework such as Ember or Angular, as that’s what most businesses use, so it would help you more if you wanted to look for jobs.