Slide 1

Slide 1 text

@hpoom Javascript One language to rule them all By Simon Wood 1 www.CTO-meetup.com

Slide 2

Slide 2 text

/ @hpoom About me Associate Director of Architecture & Engineering Holiday Extras Simon Wood 2

Slide 3

Slide 3 text

@hpoom We are building the future of travel

Slide 4

Slide 4 text

/ @hpoom 4 What I am going to cover Single Page Web Apps Javascript Language Future of Javascript Server Side Javascript

Slide 5

Slide 5 text

@hpoom 5 "JavaScript: Good Parts vs. The Rest" by Nathan Smith. Licensed under Creative Commons.- https://flic.kr/p/8aGB5o

Slide 6

Slide 6 text

@hpoom 6 Math.min() < Math.max(); // false typeof NaN; // “number” typeof null; // ”object” null instanceof Object; // false 0.1 + 0.2 == 0.3; // false

Slide 7

Slide 7 text

@hpoom 7

Slide 8

Slide 8 text

@hpoom Javascript The Language 8

Slide 9

Slide 9 text

@hpoom popularity 9

Slide 10

Slide 10 text

@hpoom 10

Slide 11

Slide 11 text

@hpoom Wide use cases 11

Slide 12

Slide 12 text

@hpoom standards 12

Slide 13

Slide 13 text

@hpoom 13

Slide 14

Slide 14 text

/ @hpoom Can I use caniuse.com

Slide 15

Slide 15 text

/ @hpoom Node Green node.green

Slide 16

Slide 16 text

@hpoom Client Side Javascript 16

Slide 17

Slide 17 text

@hpoom 17 $( document ).ready(function() { // Handler for .ready() called. }); $(function() { // Handler for .ready() called. });

Slide 18

Slide 18 text

@hpoom jquery 18

Slide 19

Slide 19 text

@hpoom HTML5 Needs JS 19

Slide 20

Slide 20 text

@hpoom Single Page Web Apps 20

Slide 21

Slide 21 text

@hpoom What are single page apps? 21

Slide 22

Slide 22 text

@hpoom thin client THICK CLIENT 22

Slide 23

Slide 23 text

@hpoom Advantages Disadvantages 23

Slide 24

Slide 24 text

/ @hpoom Backbone Single Page Web App Frameworks 24 Angular Ember

Slide 25

Slide 25 text

/ @hpoom TodoMVC todomvc.com

Slide 26

Slide 26 text

@hpoom React 26

Slide 27

Slide 27 text

@hpoom What is React? 27

Slide 28

Slide 28 text

@hpoom Components 28

Slide 29

Slide 29 text

@hpoom 29

Slide 30

Slide 30 text

@hpoom Data Binding 30

Slide 31

Slide 31 text

@hpoom 31 Actions – Helper methods that facilitate passing data to the Dispatcher Dispatcher – Receives actions and broadcasts payloads to registered callbacks Stores – Containers for application state & logic that have callbacks registered to the dispatcher Controller Views – React Components that grab the state from Stores and pass it down via props to child components.

Slide 32

Slide 32 text

@hpoom 32 bit.ly/cartoonRedux

Slide 33

Slide 33 text

@hpoom DOM 33 Virtual

Slide 34

Slide 34 text

@hpoom 34

Slide 35

Slide 35 text

@hpoom JSX 35

Slide 36

Slide 36 text

@hpoom 36 var Component = React.createClass({ render: function() { return (

Hello World

) } }) ReactDOM.render(, document.body)

Slide 37

Slide 37 text

@hpoom 37 var Component = React.createClass({ render: function() { return React.createElement( “h1", null, "Hello World” ) } }) ReactDOM.render(, document.body)

Slide 38

Slide 38 text

@hpoom 38 var Component = React.createClass({ render: function() { return (

Hello World

) } }) ReactDOM.render(, document.body)

Slide 39

Slide 39 text

@hpoom Props 39

Slide 40

Slide 40 text

@hpoom 40 var Component = React.createClass({ propTypes: { name: React.PropTypes.string.isRequired }, render: function() { return (

Hello {this.props.name}

) } }) ReactDOM.render(, document.body)

Slide 41

Slide 41 text

@hpoom 41 var Component = React.createClass({ propTypes: { name: React.PropTypes.string.isRequired }, render: function() { return (

Hello {this.props.name}

) } }) ReactDOM.render(, document.body)

Slide 42

Slide 42 text

@hpoom State 42

Slide 43

Slide 43 text

@hpoom 43 var Counter = React.createClass({ getInitialState: function() { return { count: 0 } }, render: function() { return ( {this.state.count} ) } onButtonClick: function() { this.setState({ count: ++this.state.count }) } }) ReactDOM.render(, document.body)

Slide 44

Slide 44 text

@hpoom 44 var Counter = React.createClass({ getInitialState: function() { return { count: 0 } }, render: function() { return ( {this.state.count} ) } onButtonClick: function() { this.setState({ count: ++this.state.count }) } }) ReactDOM.render(, document.body)

Slide 45

Slide 45 text

@hpoom 45 var Counter = React.createClass({ getInitialState: function() { return { count: 0 } }, render: function() { return ( {this.state.count} ) } onButtonClick: function() { this.setState({ count: ++this.state.count }) } }) ReactDOM.render(, document.body)

Slide 46

Slide 46 text

@hpoom 46 var Counter = React.createClass({ getInitialState: function() { return { count: 0 } }, render: function() { return ( {this.state.count} ) } onButtonClick: function() { this.setState({ count: ++this.state.count }) } }) ReactDOM.render(, document.body)

Slide 47

Slide 47 text

@hpoom Relay 47

Slide 48

Slide 48 text

@hpoom Babel 48

Slide 49

Slide 49 text

/ @hpoom RequireJS Module Including & Bundling 49 Browserify Webpack

Slide 50

Slide 50 text

@hpoom Challenges 50

Slide 51

Slide 51 text

/ @hpoom Sentry Error Reporting Tools 51 Bugsnag Airbrake

Slide 52

Slide 52 text

/ @hpoom Bugsnag bugsnag.com

Slide 53

Slide 53 text

@hpoom Analytics 53

Slide 54

Slide 54 text

@hpoom SEO With Single Page Apps 54

Slide 55

Slide 55 text

@hpoom Security 55

Slide 56

Slide 56 text

@hpoom Server Side Javascript 56

Slide 57

Slide 57 text

@hpoom Node JS 57

Slide 58

Slide 58 text

@hpoom 58

Slide 59

Slide 59 text

@hpoom 59

Slide 60

Slide 60 text

@hpoom Why Choose Node JS 60

Slide 61

Slide 61 text

@hpoom Full Stack Javascript 61

Slide 62

Slide 62 text

@hpoom Event Driven 62

Slide 63

Slide 63 text

@hpoom 63

Slide 64

Slide 64 text

@hpoom Hell 64 Callback

Slide 65

Slide 65 text

@hpoom 65 getData(function(a){ getMoreData(a, function(b){ getMoreData(b, function(c){ getMoreData(c, function(d){ getMoreData(d, function(e){ getMoreData(e, function(f){ ... }); }); }); }); }); });

Slide 66

Slide 66 text

@hpoom Promises 66

Slide 67

Slide 67 text

@hpoom 67 asyncCall().then(function(data1){ // do something... return anotherAsyncCall(); }).then(function(data2){ // do something... return oneMoreAsyncCall(); }).then(function(data3){ // the third and final async response }).fail(function(err) { // handle any error from any of the above calls }).done();

Slide 68

Slide 68 text

@hpoom HTTP baked in 68

Slide 69

Slide 69 text

@hpoom NPM 69

Slide 70

Slide 70 text

@hpoom 70 www.modulecounts.com

Slide 71

Slide 71 text

@hpoom Challenges 71

Slide 72

Slide 72 text

@hpoom Single Instance 72

Slide 73

Slide 73 text

@hpoom 73 var express = require('express'); var app = express(); var globalCount = 0; app.get('/', function (req, res) { var localCount = 0; globalCount++; localCount++; res.send('You visited #' + localCount + ' times! Total visits #' + globalCount); }); app.listen(8080);

Slide 74

Slide 74 text

@hpoom 74 You visited #1 times! Total visits #1 You visited #1 times! Total visits #2 You visited #1 times! Total visits #3 You visited #1 times! Total visits #4 You visited #1 times! Total visits #5

Slide 75

Slide 75 text

@hpoom Exit On Error 75

Slide 76

Slide 76 text

@hpoom 76 1.Close the server to stop accepting new connections. 2.Wait for existing connections to finish and close normally. 3.Only exit the process once all clients have finished and disconnected happily. 4.Failsafe: before starting the shutdown, it’s advisable to set an exit time limit. If the shutdown hangs or takes too long, something else is probably wrong so exit the process anyway.

Slide 77

Slide 77 text

@hpoom Single Threaded 77

Slide 78

Slide 78 text

/ @hpoom PM2 pm2.keymetrics.io

Slide 79

Slide 79 text

@hpoom No Web Server 79

Slide 80

Slide 80 text

@hpoom Memory Management 80

Slide 81

Slide 81 text

@hpoom 81

Slide 82

Slide 82 text

@hpoom 82

Slide 83

Slide 83 text

@hpoom IO js 83

Slide 84

Slide 84 text

@hpoom 84

Slide 85

Slide 85 text

@hpoom 85

Slide 86

Slide 86 text

@hpoom Future of Javascript 86

Slide 87

Slide 87 text

@hpoom Evolution 87

Slide 88

Slide 88 text

@hpoom Desktop App Development 88

Slide 89

Slide 89 text

/ @hpoom Electron electron.atom.io

Slide 90

Slide 90 text

@hpoom Mobile App Development 90

Slide 91

Slide 91 text

/ @hpoom Ionic ionicframework.com

Slide 92

Slide 92 text

@hpoom Thank you please contact me if you have any questions Twitter: @hpoom logo 92 By Simon Wood www.CTO-meetup.com