Slide 1

Slide 1 text

MODERN WEB APPLICATION DEVELOPMENT WORKFLOW

Slide 2

Slide 2 text

FIRST, LET’S LOOK AT THE PAST

Slide 3

Slide 3 text

HOW WEB APPLICATIONS USED TO BE DONE?

Slide 4

Slide 4 text

THROW A BUNCH OF HTML FILES

Slide 5

Slide 5 text

THROW A BUNCH OF HTML FILES ADD A COUPLE OF CSS FILES

Slide 6

Slide 6 text

THROW A BUNCH OF HTML FILES ADD A COUPLE OF CSS FILES PUT SOME JAVASCRIPT IN ALL THIS

Slide 7

Slide 7 text

THROW A BUNCH OF HTML FILES ADD A COUPLE OF CSS FILES PUT SOME JAVASCRIPT IN ALL THIS AND CALL IT A DAY...

Slide 8

Slide 8 text

COME BACK 6 MONTHS LATER AND TRY TO REMEMBER HOW TO MAINTAIN YOUR CODE

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

MOVING FORWARD

Slide 11

Slide 11 text

A NODE.JS WORLD

Slide 12

Slide 12 text

Node.js ≠ Server-side JavaScript

Slide 13

Slide 13 text

Node.js stand alone JavaScript runtime

Slide 14

Slide 14 text

Node.js stand alone JavaScript applications

Slide 15

Slide 15 text

Node.js stand alone JavaScript applications created by JavaScript developers

Slide 16

Slide 16 text

Node.js stand alone JavaScript applications created by JavaScript developers for JavaScript developers

Slide 17

Slide 17 text

BRAND NEW WORLD

Slide 18

Slide 18 text

JAVASCRIPT DEVELOPMENT TOOLS

Slide 19

Slide 19 text

JAVASCRIPT DEVELOPMENT WORKFLOW

Slide 20

Slide 20 text

A GOOD DEVELOPMENT WORKFLOW -HELPS YOU GET STARTED

Slide 21

Slide 21 text

A GOOD DEVELOPMENT WORKFLOW -HELPS YOU GET STARTED -MAINTAINS YOUR DEPENDENCIES

Slide 22

Slide 22 text

A GOOD DEVELOPMENT WORKFLOW -HELPS YOU GET STARTED -MAINTAINS YOUR DEPENDENCIES -ENFORCES BEST PRACTICES

Slide 23

Slide 23 text

A GOOD DEVELOPMENT WORKFLOW -HELPS YOU GET STARTED -MAINTAINS YOUR DEPENDENCIES -ENFORCES BEST PRACTICES -PREPARES YOUR TOOLS

Slide 24

Slide 24 text

A GOOD DEVELOPMENT WORKFLOW -HELPS YOU GET STARTED -MAINTAINS YOUR DEPENDENCIES -ENFORCES BEST PRACTICES -PREPARES YOUR TOOLS -FIGHTS REGRESSIONS

Slide 25

Slide 25 text

A GOOD DEVELOPMENT WORKFLOW -HELPS YOU GET STARTED -MAINTAINS YOUR DEPENDENCIES -ENFORCES BEST PRACTICES -PREPARES YOUR TOOLS -FIGHTS REGRESSIONS -EASES THE RELEASE PROCESS

Slide 26

Slide 26 text

HOW TO GET STARTED?

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

YEOMAN Born in 2012 Various contributors (Employees from Google, Twitter, etc)

Slide 29

Slide 29 text

YEOMAN scaffolding - structure - compilation - static analysis - dependencies management - development tools - unit testing

Slide 30

Slide 30 text

YEOMAN download > npm install -g yo “-g” global install

Slide 31

Slide 31 text

YEOMAN Various generators: ○ Angular ○ Ember ○ Backbone And all the other popular frameworks...

Slide 32

Slide 32 text

YEOMAN bootstrapping You can also use Yeoman to generate an Yeoman generator project

Slide 33

Slide 33 text

YEOMAN angular.js generator > npm install -g generator-angular

Slide 34

Slide 34 text

YEOMAN create an Angular project > yo angular

Slide 35

Slide 35 text

YEOMAN select some dependencies

Slide 36

Slide 36 text

YEOMAN choose some options

Slide 37

Slide 37 text

YEOMAN it creates the project

Slide 38

Slide 38 text

YEOMAN it downloads the internet

Slide 39

Slide 39 text

YEOMAN it uses some dark magic

Slide 40

Slide 40 text

Enjoy the view, Yeoman takes care of everything…

Slide 41

Slide 41 text

No content

Slide 42

Slide 42 text

What does the result look like?

Slide 43

Slide 43 text

STRUCTURE

Slide 44

Slide 44 text

CONTENT

Slide 45

Slide 45 text

DEPENDENCIES

Slide 46

Slide 46 text

DEV TOOLS

Slide 47

Slide 47 text

YEOMAN evolution over time > yo angular:controller myController create the code and its unit test

Slide 48

Slide 48 text

IT’S MAGIC! and it will be your job to maintain it...

Slide 49

Slide 49 text

HAPPY?

Slide 50

Slide 50 text

BUT HOW DOES IT WORK?

Slide 51

Slide 51 text

YEOMAN HAS FRIENDS

Slide 52

Slide 52 text

BOWER

Slide 53

Slide 53 text

No content

Slide 54

Slide 54 text

GRUNT

Slide 55

Slide 55 text

No content

Slide 56

Slide 56 text

GULP

Slide 57

Slide 57 text

No content

Slide 58

Slide 58 text

AND OTHERS

Slide 59

Slide 59 text

DEPENDENCIES MANAGEMENT

Slide 60

Slide 60 text

BOWER

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

BOWER Package manager for the web Born in 2012 Created by Twitter and other contributors over time

Slide 63

Slide 63 text

BOWER Download > npm install -g bower

Slide 64

Slide 64 text

BOWER Find a package > bower search jquery

Slide 65

Slide 65 text

BOWER Find the versions available > bower info jquery

Slide 66

Slide 66 text

BOWER Add a specific dependency > bower install jquery#1.10.2 --save install jquery and save this new dependency

Slide 67

Slide 67 text

BOWER runtime dependencies in bower.json

Slide 68

Slide 68 text

DEPENDENCIES

Slide 69

Slide 69 text

LOCATION

Slide 70

Slide 70 text

BOWER Add all your dependencies > bower install

Slide 71

Slide 71 text

BOWER See your dependencies > bower list

Slide 72

Slide 72 text

BOWER Package management always comes with its set of problems:

Slide 73

Slide 73 text

BOWER Package management always comes with its set of problems: - how can I create a new package?

Slide 74

Slide 74 text

BOWER Package management always comes with its set of problems: - how can I create a new package? - how can I host a bower repository?

Slide 75

Slide 75 text

BOWER Package management always comes with its set of problems: - how can I create a new package? - how can I host a bower repository? - what kind of exotic tools will I have to use?

Slide 76

Slide 76 text

BOWER Create a bower package > bower init

Slide 77

Slide 77 text

BOWER Host a bower repository

Slide 78

Slide 78 text

BOWER Host a bower repository > git init

Slide 79

Slide 79 text

BOWER Host a bower repository > git init > git add .

Slide 80

Slide 80 text

BOWER Host a bower repository > git init > git add . > git commit -m “Initial commit.”

Slide 81

Slide 81 text

BOWER Host a bower repository > git init > git add . > git commit -m “Initial commit.” > git remote add origin …

Slide 82

Slide 82 text

BOWER Host a bower repository > git init > git add . > git commit -m “Initial commit.” > git remote add origin … > git push origin master

Slide 83

Slide 83 text

BOWER Host a bower repository SVN support has been added with bower 1.3 for those who care….

Slide 84

Slide 84 text

BOWER Use bower with Git > bower install https://myrepository.git

Slide 85

Slide 85 text

BOWER Host multiple versions > git tag -a 1.4 -m 'version 1.4' > bower install https://myrepository.git#1.4

Slide 86

Slide 86 text

BOWER Host multiple versions Use semantic versioning to easily let your consumers handle API breakages

Slide 87

Slide 87 text

BOWER Download > bower install jquery > bower install git://github.com/jquery/jquery.git

Slide 88

Slide 88 text

BOWER Download > bower install jquery > bower install git://github.com/jquery/jquery.git How do this work?

Slide 89

Slide 89 text

BOWER Registry https://github.com/bower/registry A simple web server listing Git repository URLs

Slide 90

Slide 90 text

BOWER Register > bower register myrepository https://…git > bower install myrepository

Slide 91

Slide 91 text

BUILD

Slide 92

Slide 92 text

No content

Slide 93

Slide 93 text

GRUNT GULP

Slide 94

Slide 94 text

CONFIGURATION GULP CODE GRUNT

Slide 95

Slide 95 text

EQUALLY POWERFUL

Slide 96

Slide 96 text

GRUNT is a bit older so its ECOSYSTEM is more mature

Slide 97

Slide 97 text

Grunt and Gulp development tools dependencies in package.json >npm install

Slide 98

Slide 98 text

DEV TOOLS

Slide 99

Slide 99 text

GRUNT

Slide 100

Slide 100 text

No content

Slide 101

Slide 101 text

GRUNT Configuration in Gruntfile.js

Slide 102

Slide 102 text

GRUNT gruntfile.js structure 3 parts: -Task loading -Task configuration -Task registration

Slide 103

Slide 103 text

GRUNT An example: Static code analysis with JSHINT

Slide 104

Slide 104 text

GRUNT

Slide 105

Slide 105 text

HOW DO YOU USE IT? >grunt >grunt jshint:all

Slide 106

Slide 106 text

GULP

Slide 107

Slide 107 text

No content

Slide 108

Slide 108 text

GULP Configuration in Gulpfile.js

Slide 109

Slide 109 text

GULP gulpfile.js structure 3 parts: - task loading - task configuration - task registration

Slide 110

Slide 110 text

GULP

Slide 111

Slide 111 text

GULP launch > gulp

Slide 112

Slide 112 text

SOUNDS FAMILIAR?

Slide 113

Slide 113 text

GULP differences with Grunt node.js streams (asynchronous by nature) nice and simple api concurrent execution with Orchestrator

Slide 114

Slide 114 text

BUILD TASKS

Slide 115

Slide 115 text

STATIC ANALYSIS grunt-contrib-jshint gulp-jshint Detect coding errors in your JavaScript files (Checkstyle-like reports)

Slide 116

Slide 116 text

RESPONSIVE IMAGES grunt-responsive-images gulp-responsive-images Produce images at different sizes for responsive websites

Slide 117

Slide 117 text

COMPRESS IMAGES grunt-contrib-imagemin gulp-imagemin Compress and optimize images

Slide 118

Slide 118 text

COFFEESCRIPT grunt-contrib-coffee gulp-coffee Compile CoffeeScript source code to JavaScript

Slide 119

Slide 119 text

SASS grunt-contrib-sass gulp-sass Compile SASS to CSS

Slide 120

Slide 120 text

WHY SASS? - import - extends - function - mixins - variables - compilation errors

Slide 121

Slide 121 text

MINIFICATION grunt-contrib-uglify gulp-uglify Reduce the size of JavaScript files

Slide 122

Slide 122 text

CSS TRIMMING grunt-uncss gulp-uncss-task Remove unused CSS rules

Slide 123

Slide 123 text

TESTING

Slide 124

Slide 124 text

TESTING Frameworks: Jasmine, Mocha, QUnit Runner: Karma Code Coverage: Istanbul

Slide 125

Slide 125 text

TESTING Hudson/Jenkins integration? karma-junit-reporter karma-coverage (Cobertura reports)

Slide 126

Slide 126 text

No content

Slide 127

Slide 127 text

CHROME DEVTOOLS

Slide 128

Slide 128 text

WORKSPACE

Slide 129

Slide 129 text

SNIPPETS

Slide 130

Slide 130 text

AUDITS

Slide 131

Slide 131 text

TIMELINE

Slide 132

Slide 132 text

REMOTE DEBUGGING

Slide 133

Slide 133 text

DEMONSTRATION Murphy’s Law: Anything that can go wrong — will go wrong

Slide 134

Slide 134 text

BACKUP SLIDES (if everything failed, you still have some pictures)

Slide 135

Slide 135 text

No content

Slide 136

Slide 136 text

No content

Slide 137

Slide 137 text

No content

Slide 138

Slide 138 text

No content

Slide 139

Slide 139 text

KARMA + GRUNT/GULP Test your application on various devices

Slide 140

Slide 140 text

No content

Slide 141

Slide 141 text

TO SUM UP

Slide 142

Slide 142 text

YEOMAN + BOWER + GRUNT/GULP and their plugins… = AWESOME

Slide 143

Slide 143 text

QUESTIONS?

Slide 144

Slide 144 text

THANKS! Stéphane Bégaudeau Twitter: @sbegaudeau Google+: +stephane.begaudeau The research leading to these results has received funding from the European Union’s Seventh Framework Program (FP7/2007-2013) for CRYSTAL – Critical System Engineering Acceleration Joint Undertaking under grant agreement № 332830 and from specific national programs and/or funding authorities.