On Angular.js

Probably everyone who want to built modern web applications stood once before the choice of the framework, so did i a 2 years back. At the time angular.js became popular and i stood before the decision to either use backbone, ember.js or angular.

What i didn’t like about angular was its very specific HTML attribute syntax. I wanted to write clean HTML not some custom attribute mess.

Luckily i stumbled over Meteor!

At the time Meteor was not quite ready yet and single page apps were not the standard, so it was quite a risk. I went that road and build a Meteor app, which only used its frontend part (mostly minimongo and its templating engine). Sadly this app was never really used by a lot of people, due to a funding stop, but it worked well at all times and could perfectly connect to a LAMPP stack API. Talking from now i can see that it was the best choice ever.

Not only did Meteor evolved to (IMHO) the leading framework when it comes to technology and brilliance of its code base, but its also future save, as its templating engine works already perfectly with the coming standards of Web Components!

Angulars future

Because Angular.js is still the industry standard and many rest on the note that “Google supports it” i want to quote here Rob Eisenberg a former angular.js core developer. Its actually an article about angular.js 2.0 and why change is necessary there, but it showcases very good the problems of the current angular.js (And which is probably also true for other frameworks, like ember.js and backbone):

When AngularJS was first created, almost five years ago, it was not originally intended for developers. It was a tool targeted more at designers who needed to quickly build persistent HTML forms. Over time it has changed to accommodate a variety of scenarios and developers have picked it up and used it to build more and more complex applications. The Angular 1.x team has worked hard over the years to make incremental changes to the design, allowing it to continue to be relevant as the needs of modern web applications have changed. However, there are hard limits on the improvements that can be made, due to assumptions that were made as part of the original design. A number of these limits relate to performance problems resulting from the current binding and templating infrastructure. In order to fix those problems, new strategies are needed.

This is basically the difference between Angular and Meteor. Meteor was built from the ground up as a framework for single page apps, where all components are working together like apple products. Whereas Angular was started as a form builder and grew into what it is today.

Elaborating on the coming web components he states:

When these specifications become available in all major browsers, we are likely to see developer creativity explode as many endeavor to create reusable components to solve common problems or address deficiencies in the standard HTML toolkit (from Databinding With Web Components). It’s already possible today in Chrome and the other browsers have some of these specs implemented and are working on others. The future sounds awesome right? There’s just one problem: most of today’s databinding frameworks aren’t prepared for this. Most frameworks, Angular 1.x included, have a databinding system that works based on the assumption of a small number of known HTML elements with well-known events and behaviors. In order for Angular developers to take advantage of Web Components, a new implementation of databinding is needed.

(Taken from http://eisenbergeffect.bluespire.com/all-about-angular-2-0/)

Looking at Meteor and its brilliant templating engine blaze, it already works fully with native web components and can update their values reactively.

Sure Angular.js 2.0 will fix that, but where will Meteor be at that time? Its quite possible that Meteor will overhaul Angular.js in the coming months. Currently Angular.js has ~33 000 Github Stars, were Meteor has “only” ~21 000.

The ranks

If we look Github repositories and stars we see the following top rank for JavaScript repositories:

  1. joyent/node 33,998 Stars
  2. angular/angular.js 33,633 Stars
  3. mbostock/d3 33,059 Stars
  4. jquery/jquery 32,973 Stars
  5. h5bp/html5-boilerplate 27,855 Stars
  6. bartaz/impress.js 22,763 Stars
  7. meteor/meteor 21,592 Stars

This shows what’s the current state, though i believe, when people use Meteor and realise how much faster and cleaner it allows them to built complex JavaScript applications, we will see Meteor a lot higher up.

So whats the point of this article?

I just wanted to express my love for Meteor and put it in perspective to the current Angular.js implementation.

To sum up what makes Meteor so awesome:

  • The DOM engine Blaze, with its template system Spacebars. It generates clean HTML, uses the simple Handlebars syntax and is fully reactive, which removes the need to spaghetti code.
  • Minimongo, a client side query able fully reactive in memory database. It allows to focus on a good data structure and its reactivity makes sure the correct data is represented in all the templates and functions.
  • DDP and its publication/subscription model. This makes building API’s a thing of the past, as one just have to publish the right set of documents and Meteor takes care of streaming them to the client when subscribed to.
  • Meteor package system, which allows to build isomorphic packages, means packages which can contain client as well as server side code. This packages are also super simple to create and manage.
  • Meteor’s commandline tool, which makes developing apps so much faster. You never have to link files or write endless grunt scripts anymore.

You can read about all the Meteor core tools here.

If you are a Angular.js developer I would love to get some feedback on the list of basic toolsets Meteor delivers. What components Angular has that make you excited?

  • Philipp W├╝llner

    Great to have some Meteor expertise in Germany. :) Greetings from NRW.

    • http://frozeman.de/ Fabian Vogelsteller

      Thanks, we have quite some people here in Berlin at the #Meteor meetups. I hope Meteor is going viral soon, developers missing out if they don’t try it.