Finjs - Angular 2 better faster stronger

24
Angular2 Better Faster Stronger and Everywhere Christoffer Noring @chris_noring

Transcript of Finjs - Angular 2 better faster stronger

Page 1: Finjs - Angular 2 better faster stronger

Angular2Better Faster Stronger and Everywhere

Christoffer Noring@chris_noring

Page 2: Finjs - Angular 2 better faster stronger

About meGoogle Developer Expert

Page 3: Finjs - Angular 2 better faster stronger

History

Page 4: Finjs - Angular 2 better faster stronger

According to legend it was built in 2 weeks

2009Mishko Hevery

Was built to increase speed of development

GetAngular => AngularJS

Page 5: Finjs - Angular 2 better faster stronger

Angular is the best thing since sliced bread

Our backend/frontend coders picked it up in 3-4 days

Double binding makes CRUD so easy

It makes us so productive

12000+ sites using angular

In 2013 we were like

Angular all the things !!!

Page 6: Finjs - Angular 2 better faster stronger

In 2015 we were like

Double binding is so bad

Angular change detection is wack

Watchers watchers watchers, no more than 2000 or it blows up

We know how to code Angular but do we know javascript?

Uniform data flow is so much better, let’s do react

It doesn’t render so fast

Why are there so many concepts, providers, service, factory etc..

Page 7: Finjs - Angular 2 better faster stronger

We must changeWe must be better

Page 8: Finjs - Angular 2 better faster stronger

We can be faster

Roger Bannister. English mile under 4 min

Page 9: Finjs - Angular 2 better faster stronger

FPS * 2

Page 10: Finjs - Angular 2 better faster stronger

number of frames that take longer than 16.6ms to be drawnstuttering, non smooth behaviour

Page 11: Finjs - Angular 2 better faster stronger

total amount of time spent by the browser executing JavaScript code

Page 12: Finjs - Angular 2 better faster stronger

I can do betterLew Hoad won 8-0 against Laver in the 60s Ken Rosewall won 11/13 games against Laver in the 60s

Rod Laver improved to become one of the best players ever

Angular 1 was/is beaten by React, Vue, Ember etc..

Angular can be better

Change detection can be done better

Page 13: Finjs - Angular 2 better faster stronger

How is Angular 2 better

Page 14: Finjs - Angular 2 better faster stronger

Improved change detection

Reduced number of concepts

Typescript a first class citizen

Uses decorators from ES7

Better tooling with Augury and Angular CLI

Mobile first

Page 15: Finjs - Angular 2 better faster stronger

AOT,Treeshakingreducing the bundle size

Page 16: Finjs - Angular 2 better faster stronger

Tree shakingexcluding code you’re not using

Webpack for example, removes reference to unused code

Uglify removes unused code from the bundle

-70% reduction

app globalsreflect-metadatazone.js

shaked out

not used

used

dependency graph

Page 17: Finjs - Angular 2 better faster stronger

AOTahead of time compilation

AOT vs JIT, just in time compilationcapture template errors early vs at runtime

compiler runs once at build time using one set of libraries

The browser loads executable code no compilation

The compiler inlines external html templates css style sheets

no ajax requests for these assets

ResultsCompiled code takes less sizeCompiler not shipped

Page 18: Finjs - Angular 2 better faster stronger

Lazy loadingStarting component

App

Lazy

Decreases how much of our app is initially loaded

Using router + NgModules

Page 19: Finjs - Angular 2 better faster stronger

rxjs everywhere instead of flawed promises

Easy to add things like Firebase, AngularFire and Material Design

Lets make it easy to use service workers

Server side rendering with Angular Universal, app renders in 1 min, initial events recorded and replayed

Lets add support for uniform data flow, flux, ngrx etc..

Page 20: Finjs - Angular 2 better faster stronger

Has upgrade path with ngUpgrade, ngMetadata

And as always lets make it testable, unit tests e2e tests with protractor etc

Page 21: Finjs - Angular 2 better faster stronger

Its all about components + component router

@Component({ selector: ‘messenger’, template: '<div>Hello, {{message}}</div>'})class Messenger { message: string;

constructor() { this.message = 'World'; }}

Decorator @

decorates

a class

Page 22: Finjs - Angular 2 better faster stronger

True native apps with native script

Electron, ng2 desktop

We can be everywhere

Ionic 2 for angular 2WebView

Page 23: Finjs - Angular 2 better faster stronger

Dedicated teams for developing apps in Dart or Typescript versions of angular2

Ton of GDEs spreading the word

Stronger

Adoption github likes angular 1 and angular218445 stars53589 stars

Page 24: Finjs - Angular 2 better faster stronger

Thank you for listening