Slide 1

Slide 1 text

JavaScript The Past, Present and Future

Slide 2

Slide 2 text

Kim Joar Bekkelund @kimjoar [email protected] Fagleder i JS-plattform Jobbet i BEKK siden 2011

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

It all started at 1995

Slide 6

Slide 6 text

Brendan Eich + 10 days = JavaScript

Slide 7

Slide 7 text

What did we do with this new language? (You really don't want to know)

Slide 8

Slide 8 text

CUT & PASTE

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

… and this went on for almost 10 years

Slide 13

Slide 13 text

2004

Slide 14

Slide 14 text

2005

Slide 15

Slide 15 text

What happened?

Slide 16

Slide 16 text

What happened?

Slide 17

Slide 17 text

What happened?

Slide 18

Slide 18 text

What happened?

Slide 19

Slide 19 text

JavaScript went from nothing to …

Slide 20

Slide 20 text

"any application that can be written in JavaScript, will eventually be written in JavaScript." Atwood's Law

Slide 21

Slide 21 text

JavaScript Where are we now?

Slide 22

Slide 22 text

We expect more!

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

SPA Single-page applications

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

10/90? 50/50? 70/30?

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

WebSockets Client Server Set up connection

Slide 31

Slide 31 text

JavaScript + I/O Single-threaded, non-blocking

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

Node.js in production?

Slide 34

Slide 34 text

“Assembly language of the web”

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

# Assignment: number = 42 opposite = true # Conditions: number = -42 if opposite # Functions: square = (x) -> x * x # Arrays: list = [1, 2, 3, 4, 5] # Objects: math = root: Math.sqrt square: square cube: (x) -> x * square x Inspired by Ruby and Python Several features will be added to the next JS version

Slide 37

Slide 37 text

class Point { x: number; y: number; constructor(x: number, y: number) { this.x = x; this.y = y; } getDist() { return Math.sqrt( this.x * this.x + this.y * this.y ); } } var p = new Point(3,4); var dist = p.getDst(); console.log("Hypotenuse is: " + dist); Optional static typing. Superset of JS.

Slide 38

Slide 38 text

data Person = Person { name :: String, age :: Number } showPerson :: Person -> String showPerson (Person o) = o.name ++ ", aged " ++ show o.age examplePerson :: Person examplePerson = Person { name: "Bonnie", age: 26 } Inspired by Haskell

Slide 39

Slide 39 text

(ns example (:require [om.core :as om] [om.dom :as dom])) (defn widget [data owner] (reify om/IRender (render [this] (dom/h1 nil (:text data))))) (om/root widget {:text "Hello world!"} {:target (. js/document (getElementById "my-app"))}) A Lisp for the browser

Slide 40

Slide 40 text

asm.js Speeding up compiled languages

Slide 41

Slide 41 text

asm.js Speeding up compiled languages "an extraordinarily optimizable, low-level subset of JavaScript"

Slide 42

Slide 42 text

C/C++ -> LLVM -> Emscripten -> asm.js

Slide 43

Slide 43 text

int f(int i) { return i + 1; } C function f(i) { i = i|0; return (i + 1)|0; } asm.js

Slide 44

Slide 44 text

But what happens when you can run C and C++ code in the browser?

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

millions of lines of C compiled to asm.js/JavaScript running in a browser !

Slide 49

Slide 49 text

JavaScript The future

Slide 50

Slide 50 text

language, apps, ecosystem, VM

Slide 51

Slide 51 text

LANGUAGE the

Slide 52

Slide 52 text

ES1 1997 ES2 1998 ES3 1999 ES4 Abandoned ES5 2009 ES6 2015 ES7 est. 2016

Slide 53

Slide 53 text

Adjustments based on real-world problems

Slide 54

Slide 54 text

No content

Slide 55

Slide 55 text

Datainn </scr <script src="../shared/vendor/bower_components/underscore/undersco <script src="../shared/vendor/bower_components/jquery/jquery.min.j <script src="../shared/vendor/bower_components/spin.js/spin.js"></ <script src="../shared/vendor/bower_components/angular/angular.js" <script src="../shared/vendor/bower_components/angular-route/angul <script src="../shared/vendor/bower_components/angular-animate/ang <script src="../shared/vendor/bower_components/ng-table/ng-table.j <script src="../shared/vendor/bower_components/moment/moment.js">< <script src="../shared/vendor/bower_components/moment/lang/nb.js"> <script src="../shared/vendor/bower_components/based-on/index.js"> <script src="../shared/vendor/bower_components/poller.js/poller.js <script src="../shared/vendor/bower_components/ee.js/ee.js"></scri <script src="../shared/vendor/bower_components/d3/d3.js"> </sc

Slide 56

Slide 56 text

No content

Slide 57

Slide 57 text

ECOSYSTEM the

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

Cryptography API, Audio API, WebRTC, File API …

Slide 60

Slide 60 text

60fps, but only one thread Web Workers 60fps, but only one thread

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

from mostly huge frameworks to thousands of small libraries

Slide 63

Slide 63 text

No content

Slide 64

Slide 64 text

Rendering to …

Slide 65

Slide 65 text

WebGL

Slide 66

Slide 66 text

vimeo.com/105880197 javazone webgl

Slide 67

Slide 67 text

React Native

Slide 68

Slide 68 text

No content

Slide 69

Slide 69 text

No content

Slide 70

Slide 70 text

APPS the

Slide 71

Slide 71 text

No content

Slide 72

Slide 72 text

No content

Slide 73

Slide 73 text

offline first

Slide 74

Slide 74 text

Full-featured online apps

Slide 75

Slide 75 text

No content

Slide 76

Slide 76 text

No content

Slide 77

Slide 77 text

Desktop and mobile apps

Slide 78

Slide 78 text

No content

Slide 79

Slide 79 text

chrome os, windows 8, firefox os JavaScript as a first-class citizen

Slide 80

Slide 80 text

We will see more of the backend developers on the frontend … and that's a great thing!

Slide 81

Slide 81 text

VM the

Slide 82

Slide 82 text

Browser = rendering engine + JavaScript engine

Slide 83

Slide 83 text

Chakra SpiderMonkey JavaScriptCore V8 Nashorn

Slide 84

Slide 84 text

Super-competitive market Push for new features and better performance

Slide 85

Slide 85 text

2/3 of native speed on benchmarks emscripten + asm.js

Slide 86

Slide 86 text

No content

Slide 87

Slide 87 text

Want to learn JS?

Slide 88

Slide 88 text

No content

Slide 89

Slide 89 text

No content

Slide 90

Slide 90 text

Takk for meg!