Monday, June 22, 2015

AngularU Day 1

My colleague Aaron Starkston (@astarkston) and I (@owencraig) had the opportunity to travel out to San Francisco to attend the AngularU Conference learning more about the way forward with Angular 2 and javascript. See our other posts on:

- Day 2

- Day 3

 

The opening keynote from Igor Minar, Brad Green and Misko Hevery gave a great overview of where we’re sitting with Angular 2 currently.  What really came out of this is that one of the biggest improvements that’s coming is speed. Running under angular 2, rendering speed is sitting at about 3x faster than its counterpart running under angular 1.x. The way they’re doing this is by utilising web workers for most of the framework and application code (anything that doesn’t directly touch the DOM) which will parallelize a lot of the framework and application work, removing the bottleneck that is the browsers event loop.

One of the most exciting things from this, is that it means that they’ve been able to separate the rendering engine from the application engine. So angular now has the possibility to become not just an awesome web framework, but through partnerships with people like react native, it’s able to become a full application stack for mobile, desktop and web.

The other big shift is that angular is built from the ground up using typescript, letting us use the features from ES2015 (formerly ES6) and lean on a clever type system (or not if that’s not you cup of tea). I’ll save the ins and outs of ES2015 and typescript for a later post, however the high level overview is that the language features introduced in ES6 (which is now finalised) and coming in ES7 allow for us as developers to work faster with a tighter sense of confidence that our code is doing what we expect it to without a lot of the quirks that exist in ES5 and below.

With the speed at which change is occurring in angular 2 (it is still in alpha after all) a lot of the nitty gritty about apis and the minimum code to get going is liable to be completely incorrect by the time I finish writing this so I’ll hold off on that until a later post as well. Some of the higher level concepts that I don’t see changing are:

    ·       The global-esque nature of angular 1.* services and directives (by this I mean assigning them on to the module and magicking them into existence) is going away. This is being replaced by ES6 modules, each app will need to import its dependencies explicitly

    ·       Controllers in the current sense are going away. Everything will just be a component backed by an annotated javascript class

    ·       Similarly, the existing concepts of providers, factories and services are changing, since we’re just using classes now for injection, factories aren’t really a correct way of thinking about them now

What this means is that the upgrade path from existing angular 1.* applications to angular 2 isn’t an overly difficult one as long as we start using the right patterns now. Things like abstracting much of your views to be component directives (restrict: 'E' in the existing model) as this is similar to the way that the newer web components will handle much of the application. The other things to keep note of is that ES6 / ES2015 is ready and finalised now. The tooling around this (using Babel or Typescript) is ready, there’s no reason for us to not be using this today, all new projects should be starting with these new languages.

Although I’ve breezed over some important points (I’m super excited about using angular natively though) and some thoroughly entertaining (Ward Bell on MEAN) or though provoking (Douglas Crockford on why the current web is broken and his plans to fix it) sessions, all of them are available at https://angularu.com/ng/videos. Also, the live sessions are able to be watched at https://angularu.com/ng/.

I look forward to sharing other new things from day 2 and then some more of the interesting features that ES2015 (and beyond), Typescript and Angular 2 have to offer.