Find a post...

DNN-Connect Blogs

JavaScript MVC 1.2 - Why AngularJS beats the xxxx out of knockoutJS

This is part 2 of my short series about JavaScript MVC Frameworks. It will explain why of all the existing frameworks, you should really focus on AngularJS.

Choosing the right JS MVC Framework

If you're just starting with JavaScript MVC-Frameworks you'll feel the need to use "the right tool" so that the time use is well invested. This post should help you choose AngularJS - and only AngularJS - and feel good about it.

The Really Relevant Criteria

Let's skip the religious parts of the discussion for now and decide what should determine the ideal solution:

  1. We want a solution that's simple enough to start with
  2. …but that still works when things get complex as the customers wishes accumulate
  3. We want a solution that has wide adoption - thereby ensuring thousands of examples and answers online, and ensuring that we'll find employees and consultants that can help us when we need help
  4. We want a solution that will still exist and be popular and updated - in five years' time
  5. We want a solution that is so widespread, that many helpers/plugins exist
  6. …ideally it would be something of an industry standard
  7. …and work well with other industry standards like jQuery etc.
  8. …and has reached the critical mass of followers that is hard to beat

Some not so important criteria

  1. Microsoft promoted it for a while, so it must be good
  2. It support IE6
  3. I know a guy that likes it
  4. I once heard that Google is as evil as Microsoft…
  5. I like the syntax of something
  6. It supports feature x a bit better than the other one

What are the Options?

Basically, there are more than 25 JavaScript MVC frameworks. The most popular by far is AngularJS, with emberJS and a few others still developing strongly. The most popular in the Microsoft universe of communication is knockoutJS. We'll focus on these two, and I'll tell you more about it later.

Let's look at the score

 

knockoutJS

AngularJS

Simple to start with

Yes

Yes

Scales to complex solutions

No (see note)

Yes

Wide adoption

MS only

Yes

Contributions

Good

Great

General Interest, searches in Google (to predict 5 years)

Low

High

Very widespread, lots of 3rd-party plugins

No

Yes

Almost an industry standard

No

Yes

Well integrated with other standards

Yes

Yes

Critical mass

No

Yes

In case you have some doubts about my answers above, here an additional note: knockoutJS is basically just a templating engine. It doesn't even provide a real view management, let alone route management or many other things you would need in complex environments.The only reason most Microsofties know about knockoutJS is because it was made by an MS employee and promoted at many MS events.

Just for comparison: this is what knockout calls itself: Knockout is a JavaScript library that helps you to create rich, responsive display and editor user interfaces with a clean underlying data model.

Am I just promoting AngularJS because I'm biased?

Absolutely not! We (2sic) started with knockoutJS because we heard of it as Microsoft-events. We actually created some very complex solutions using knockoutJS - including a very powerfull help/faq system. But with time, we had to admit that it's very limited. Then AngularJS documentation finally got good. It was time for us to switch.

What about KendoUI or EmberJS?

Parts of KendoUI were made open source by telerik - I guess to stay in the market. I believe they are doing an amazing job, and they finally changed their communication to be less Microsoft-focused. So in general, I do believe it has lots of potential since it's a very good product, and it's great that it can be integrated into AngularJS. But in terms of industry-wide-adoption it's too far behind. So if you like it, use it as an AngularJS add-on.

EmberJS is also gathering momentum - but nothing compared to AngularJS. I'm convinced it's great - but Angulars Head-start is amazing. Since I have to focus my energies, it's not an option.

And some Google-Trends

As you can see - very, very clear.

The clear winner: AngularJS

You may have other opinions based on specific needs - that's great. My focus is on making a living based on my work - and this requires a clear future-focused strategy. The same logic that made me chose DNN in 2003 - namely the core question of "what will make it" also defines AngularJS as the one and only clear answer. So even if another framework has some technical superiority - the sheer mass of Angular-believers will ensure that this will be corrected.

Why not learn both knockoutJS and AngularJS?

This question popped up once after a blog I wrote - and the answer again is simple if you look at the big picture:

  1. If you are working only by yourself and you're good with programming, then your brain can easily handle multiple tools and you may even feel joy in mastering diverse tools and technologies. So you would do this for the heck-of it, not for strategic reasons - go ahead.
  2. If you are budget and success focused, and need to work in a team, then multiple technologies mean that every team member has to spend time learning each technology. Each member will waste time making mistakes with each technology. You will also need to standardize various ways to handle the same problem (based on combinations of technologies already in use in a specific project). And you will need to document a lot of things, because of these many toys in use…
  3. …which is simply not cost effective, and will also cause lots of problems in the future, when you finally decide to focus on one system, but still have lots of hybrid solutions out there which you must maintain. 

Next steps

In the next parts of this series we we'll look into

  1. What is it and why you need it (done)
  2. Comparing the currently most popular frameworks AngularJS and knockoutJS (done)
  3. A simple example how to use such a framework
  4. The entire setup with data-delivery from the server - ideally without server code
  5. Discovering some sample Apps for you to adapt to your needs

With love from Switzerland,
Daniel 

Daniel Mettler grew up in the jungles of Indonesia and is founder and CEO of 2sic internet solutions in Switzerland and Liechtenstein, an 20-head web specialist with over 600 DNN projects since 1999. He is also chief architect of 2sxc (2SexyContent - see forge), an open source module for creating attractive content and DNN Apps.

 

    Daniel Mettler learned programming with the bible translation computer of his parents, deep in the jungles of Indonesia. Since he was only 12 years old at that time and the BIOS only had a version of BASICA, that's what got him started. With 16 he went back to Switzerland and learned German and basic city-survival skills. Equipped with this know-how he founded 2sic internet solutions in 1999 which was focused on web solutions on the Microsoft platform. After a few self-developed CMSs 2sic switched to DNN in 2003 and has been one of the largest partners (17 employees, 700+ projects) in Europe. Daniel is also the chief architect behind the open source 2sxc, a strong promoter of standardization (boostrap, patterns, AngularJS, checklists, etc.) and loves to eat anything - dead or alive. His motto: if the natives eat it, it game.
    Comment(s)
    Jordan
      Great Daniel. Your contributions to the DNN community are helping to quickly modernize this powerful CMS. I have made the switch to solely use Angular after a blog you wrote earlier for many of the reasons you outlined here.
    · reply · 0 0 0

    Hosting liberally provided by

    Philipp Becker 6011 7
    Geoff Barlow 547 4
    DNN-Connect 431 6
    Peter Donker 5055 30
    Christopher Hammond 680 2
    Olivier Jooris 419 1
    Daniel Mettler 12007 88
    Clint Patterson 1 1
    Jos Richters 65 1
    James Rosewell 327 2
    Will Strohl 1546 27
    Ernst Peter Tamminga 437 4
    Barry Waluszko 2798 2
    Declan Ward 450 1
    Gifford Watkins 722 9
    Torsten Weggen 2689 3