One year ago, I started a large Single Page Application (SPA) project. I spent a few weeks Googling and biting my nails, trying to choose between the various options for SPA development. I considered four leading players:
A year ago this felt like anyone’s race. I ended up selecting Knockout with Durandal for the project since the combination offered clear support for older versions of IE. I currently develop apps for automotive dealerships and they’re notoriously slow to upgrade browsers. I enjoyed the development process with Durandal and Knockout and don’t regret my decision. There’s certainly no way I could’ve pulled off such a rich, interactive UI with solely jQuery.
Yet in the last year I’ve watched the tide shift heavily toward AngularJS.
Angular’s momentum has become clear at various conferences across the country. Perhaps the most obvious recent example was at FluentConf in San Francisco:
Fluent Conf front end library session counts:
AngularJS: 15
Ember: 4
Backbone: 2
Knockout: 0For what it's worth.
— Cory House (@housecor) March 12, 2014
That’s a pretty striking contrast. Now given, one could argue high conference session counts are merely a sign that Angular is a lot more complicated! But there’s no denying Angular has massive momentum. Enough to settle into a long-term #1 spot on Pluralsight’s top 100 courses. Angular even recently spawned it’s own its own conference: ng-conf.
Today marked another huge landmark for the Angular project: Rob Eisenberg, Durandal’s creator and director, announced that Durandal is being merged with Angular. He quietly joined the Angular team a few months ago. And, going forward, there will be only maintenance releases for Durandal 2. So, Durandal’s upcoming convergence with Angular makes this basically a three horse race.
Only a few years ago JavaScript developers abandoned MooTools, Prototype, and various other frameworks to declare jQuery the de facto standard. And today, Angular has such a clear lead in inertia that I’m comfortable with this declaration:
Angular has become the de facto standard for SPA development.
Why Has Angular Become so Popular?
I see three simple reasons:
1. Google Support – Sure, Google has a long history of killing promising projects. Remember Wave and Reader? But they’re a corporate powerhouse which lends a great deal of credibility to the project. Tell your boss you want to use a free framework from Google. That’s an easy sell.
2. Integrated and Opinionated – I enjoy working with Durandal, but ultimately you must rely upon multiple technologies to create a complex SPA using Durandal including Knockout for binding, RequireJS for dependency management, and a promise library (I went with Q.js). Backbone takes a similar approach – it’s not very opinionated so developers are free to make many architectural decisions on their own or to pull in libraries like Marionnette.
In contrast, Angular is highly opinionated and offers a single integrated solution. It’s analogous to the Unix and Windows model. In Unix you perform complex tasks by piping commands. The composition of many small targeted applications provides great power and flexibility. But the masses gravitate toward opinionated and integrated solutions like Windows. Why? A simple psychological principal called the tyranny of choice. In short, abundant choice often leads to misery. It’s easier to accept a few things you dislike in Angular than to be overwhelmed with decisions in other less opinionated libraries and frameworks.
3. Testability Baked-in – The Angular team has gone to great lengths to assure that Angular apps are testable out of the box. Testing JavaScript is notoriously painful given its lack of native dependency management options and the constant temptation to interact directly with the DOM. Angular’s focus on dependency injection and testability is refreshing. It creates a “pit of success” for developers.
The Future is Evergreen
I still have concerns about Angular. One must ask why Google is making this play at all. I believe it’s the same reason they built Chrome: Angular is Google’s new lever to push the web forward. That said, I worry that Google will push too aggressively on browser standards, thereby making the framework a non-starter for unlucky developers who must support older browsers. It’s clear Google prefers to err on the side of forcing the web forward. I admire this mission, but hate to see the developers supporting legacy browsers left with few viable alternatives.
Framework developers are starting to embrace a new ideal: Soon only Evergreen browsers will be supported by modern frameworks like Angular. This term, coined by Paul Irish has a simple premise: Evergreen browsers auto update. Most of today’s current browsers are Evergreen including Chrome, Firefox, Safari, and IE10+. This trend is great news for web developers who will soon be able to enjoy the power of ECMAScript 6 and the shadow DOM with Web Components. But it means customers should be warned now. Select an auto-updating browser ASAP – The web is surging ahead and Google will use AngularJS to lead the charge.
Chime in on Hacker News, Reddit or in the comments below.
Nice post. We were in a similar situation about a year ago and looked at mostly the same frameworks you did. We chose Angular and have not looked back since. I have enjoyd using Angular although there have been some pain points also.
Cory, nice post and I agree with your assessment. The one thing I don’t like, and it’s really just terminology, is pigeon-holing the use of frameworks such as AngularJS into SPA’s. I find AngularJS to be exceptionally powerful and useful on all applications for client-side development, even legacy apps with many different pages. In fact I design many sites this way now, creating an MVC framework for multiple site pages that handles security, and then plugging in AngularJS to make each page it’s own mini-SPA. To me the benefits of an AngularJS comes with the mindset of managing a scope rather than manipulating the DOM directly. It’s just a better way to do things and leads to clean, testable code and a much more rich and dynamic UI if done properly.
Great point Ryan. I thought people preferred lighter libraries like Knockout for such purposes, but I can certainly see how Angular could be attractive for such work as well due to its simple mustache based bindings that can interact with plain JavaScript objects. In the mini-SPA pattern you’ve described, What features of Angular do you use other than two-way bindings? Thanks for the comment!
Two way binding is very nice. I really like the angularjs declarative markup and use pretty much all of the built in directives, as well as filters for how I present data. $http and $resource work nicely with REST API’s, which I use for all CRUD operations. I’m coming from the perspective of not using knockout or other frameworks and only having done some heavy jquery based apps. AngularJS is a breathe of fresh air.
Is it wrong to be wary of Angular gaining “de facto” status so quickly? I think there needs to be at least three strong competitors in this space; is Google the the only reason that Ember gets as little attention as it does? I know BackboneJS is out there too… I’m not willing to commit to All Things Google for the future of development.
I agree Mike. That’s a valid concern. I believe Google is simply using Angular to help move the web forward, but regardless, it is sad to see other excellent options getting squeezed out. JavaScript remains the wild west, so I’m confident Angular will continue to see plenty of new competition. This post is really about my epiphany that they’ve created such notable traction so quickly. Whether they become the “jQuery of SPA” remains to be seen.
Hi Cory.
Thanks for an interesting article and for your blog in general. I also just watched your video “Becoming an Outlier: Reprogramming the Developer Mind” on PluralSight. Great stuff.
I love learning new technologies and at the moment I am considering learning one of the new JavaScript GUI frameworks. I had my mind set on AngularJS, but then I read this interesting critique of AngularJS: http://tutorials.jenkov.com/angularjs/critique.html. In the conclusion Jenkov writes: “We do need to find a balance between the declarative HTML and the imperative JavaScript, but I feel that AngularJS has gone too far in the declarative direction. We do need to find ways to bind data to HTML elements/GUI components, but the one-way data binding in the AngularJS directives and two-way data binding in forms can be done better.” I hope that you have time read the article and tell me what you think.
Thanks in advance,
Anders Baumann
Thanks for the comment and the link Anders. I look forward to giving the article a read!
Cory, great article and exactly what I have been thinking. I too went down the evaluation route and chose durandal and knockout…have spent a couple of months rebuilding a silverlight app into that framework, but had a niggling doubt about durandal’s traction and it’s unfortunate failed kickstarter bid. Hearing that Rob Eisenberg was joining the Angular team and the many more job adverts asking for Angular and like you say the plethora of courses/SO, I think Angular 2.0 will be massive. Google supports Angular but it’s open source and isn’t a google product, sure it will have influence of course. My only decision now is whether to jump ship to angular now, or wait for 2.0 (no release dates as yet)….They say 2.0 will have quite a few breaking changes so I’m still on the fence! Also doing your outlier course on Pluralsight right now and enjoying it, thanks.
That’s interesting we’re in the same spot. I’ve already moved new development to Angular but am holding off on transitioning a major project in Durandal to Angular until 2.0 ships.
Great to hear you’re enjoying the outlier course! Thanks for the feedback.
I am also in the same boat. I have a product developed using Durandal & Knockout. We spent over 6 months into this. With Durandal merging with Angular, I was expecting Microsoft to make some announcement on their plan to replace Durandal, but haven’t seen (may be I missed it). Knockout still wants to be a library and not a framework. So this leave me to move to Angular for my SPA needs. Now I am waiting for Angular 2.0 & Durandal migration guide to Angular.
As Angular 2.0 beta dates are not out there, I am not sure whether to migrate (rewrite) now or wait. But definitely, I am moving out of Knockout. I liked Knockout very much.
Google is redefining web development with Object.observe – Backbone.js and Ember are getting obsolete!
Without Object.observe we currently rely on:
wrapper objects (Backbone.Model, Ember.Object)
dirty checking (Angular)
getters and setters
With wrapper objects we lose native connection with the plenty of Javascript libraries built to operate on plain objects.
On the other hand dirty checking can be expensive to perform.
Getters and setters will only notify us of changes on the property level and not of the deletion and addition of properties on the parent object.
Once Object.observe lands on all browsers, I think most people will be more than happy to go back to using plain old JS objects and AngularJS.
Wow, excellent insight. I totally agree with your forward looking assessment. Thanks for the comment!
I have one question. If angular is better than others then why I have not seen any great application (If I left google products.) like linkedin, Groupon, Foursquare, wordpress……….. developed by backbone. Since angular is older than backbone so it should have more real life examples.
This blog post is misleading.
Consider that search terms alone don’t indicate popularity.
Consider that Angular is mind bogglingly complicated.
What if people search for angular because they are so damn confused about it?
Thanks for the comment. I totally agree that search terms aren’t the only way to gauge popularity. Downloads, conference sessions, and public usage stats are of course relevant as well. If you have statistics that contradict please post them here.
Do you still feel its the De Facto Standard now that it is totally changed?
It hasn’t “totally changed” yet. That said, I agree that 2.0 looks like a radical shift. By the time it launches, it’s really hard to guess where the market will be. De Facto standards certainly come and go and at the moment it’s hard to say if 2.0’s evergreen browser requirements will be too far too soon.