Which javascript framework should I choose?

With all these javascript frameworks, which one should you choose? Which one is winning? The short answer: it's too soon to tell and it doesn't really matter. But there are some more or less safe bets.

A while ago, I was talking with a colleague over lunch about a presentation I'm preparing on Durandal (in Dutch), a javascript framework for single-page applications. I also mentioned Angular and he asked me which one is most popular, which one is winning.

If we broaden the discussion to any type of JS framework (not jut the ones for SPAs), it seems every other day a new JS tool or framework is born. Do you often get the feeling you can't keep up? Like you're in a room where everyone is shouting for your attention and you can't really understand anyone? Sometimes, it feels like the Wild West. Maybe it's better to just wait it out and see which technologies remain after the noise settles down.

That could be a rational choice. There's nothing wrong with it. I too often have doubts on whether the time I'm investing in learning something is worth it. I recently spent two weeks trying to get a Mimosa skeleton working on NodeJS in Azure. NodeJS and Azure are here to stay, but shouldn't I have looked into Yeoman and/or Grunt instead of Mimosa? Do they even do the same? I don't know!

On the other hand, this time isn't wasted, even if the technology you chose is discontinued in the future (unless you're going for commercial production-ready stuff in which case you should probably choose wisely).

First of all, the skills you will have learned are most likely to be useful in other areas. Your javascript skills will have improved, that's definitely nice. Maybe you now know how MVVM in javascript works. Or that dependency injection is actually possible. How to unit test javascript. Etcetera.

Second, chances are high you've more or less mastered your day-time job programming language (C# in my case). Sure, frameworks come and go, the language evolves, you might be switching from desktop to web,... But the time you need to learn this will be smaller because you already know the tools, the principles, the language constructs. Investing now in learning javascript and its libraries is new, exciting, interesting for the future of your career, and it won't make you forget that other language.

And finally, if you're still the careful type, some clear leaders are emerging. NodeJS is here to stay. Angular has gained enormous traction, this is no longer 'a small interesting experiment'. RequireJS is being used just about everywhere. Bower is very popular.

As I see it, we're heading towards more HTML and JS anyway… Dive into some of these technologies. Choose one and learn it. Even if your framework doesn't 'win', you'll feel more comfortable with javascript development and more easily switch to another.

All that being said, I have explored Durandal, but to be honest, I will now be taking a serious look at Angular. It seems to be getting more traction and has a larger community. Just don't think you have wasted your time if you learnt a framework that didn't really take off.

Update: on the same day that I posted this, Rob Eisenberg (of Durandal) published a post on the future of Durandal and Angular and how they will converge. Rob is working on the Angular team now, although Durandal will not be discontinued. This makes Angular even more attractive as a choice to me, but the central point of my post remains: don't be afraid of having made a wrong choice in getting to know javascript libraries or frameworks (unless maybe for critical production applications).