Mastering Web Application

(Rick Simeone) #1
Chapter 1

A sneak peek into the future


AngularJS has a truly novel approach to many aspects of web development, and it
might shape the way we write code for the future browsers. At the time of writing,
there are two interesting specifications in the works that are based on ideas similar
to the ones implemented in AngularJS.


The Object.observe (http://wiki.ecmascript.org/doku.
php?id=harmony:observe) specification aims at building into a browser the ability
to track JavaScript object changes. AngularJS relies on the object's state comparison
(dirty checking) to trigger UI repaints. Having a native in a browser—the mechanism
to detect model changes could greatly improve performance of many JavaScript MVC
frameworks, including AngularJS. In fact, the AngularJS team did some experiments
using the Object.observe specification and saw as much as 20 percent to 30 percent
performance improvements.


Web components (http://dvcs.w3.org/hg/webcomponents/raw-file/tip/
explainer/index.html) specification tries to define widgets with a level of visual
richness (which is not possible with CSS alone), and ease of composition and reuse
(which is not possible with script libraries today).


This is not an easy goal, but AngularJS directives show that it is possible to define
well-encapsulated and re-usable widgets.


AngularJS is not only an innovative framework by today's standards, but it also
influences the web development space of tomorrow. The AngularJS team works
closely with the authors of the mentioned specifications, so there is a chance that
many ideas promoted by AngularJS will make it into the browser's internals! We can
expect that time spent learning and playing with AngularJS will pay off in the future.


Summary


We've covered a lot in this chapter. Our journey started by getting familiar with
the AngularJS project and the people behind it. We've learned where to find the
library's sources and documentation, so that we could write our first "Hello World"
application. It is a pleasant surprise that AngularJS is very light-weight and easy to
start with.


Most of this chapter, though was about building solid foundations for the rest of
this booke saw how to work with the AngularJS controllers, scopes and views, and
how those elements play together. A big chunk of this chapter was devoted to the
way AngularJS services can be created in AngularJS modules and wired up using
dependency injection.

Free download pdf