Slide 1

Slide 1 text

as easy as rails

Slide 2

Slide 2 text

My name is Justin Searls Please tweet me @searls & Say [email protected]

Slide 3

Slide 3 text

1

Slide 4

Slide 4 text

2 1

Slide 5

Slide 5 text

2 1 3

Slide 6

Slide 6 text

You own a bakery.

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

Honest mistake.

Slide 11

Slide 11 text

You own a software studio.

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

Honest mistake.

Slide 17

Slide 17 text

Rails makes it too easy.

Slide 18

Slide 18 text

server-side tools

Slide 19

Slide 19 text

client-side tools

Slide 20

Slide 20 text

Just kidding.

Slide 21

Slide 21 text

client-side tools

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

Provocation:

Slide 24

Slide 24 text

Non-rubyists are building better JavaScript apps Provocation:

Slide 25

Slide 25 text

Before Rails was easy

Slide 26

Slide 26 text

Before Rails was easy JavaScript wasn't hard

Slide 27

Slide 27 text

Is JavaScript a terrible language?

Slide 28

Slide 28 text

YES DEFINITELY

Slide 29

Slide 29 text

Is that why writing JavaScript is terrible?

Slide 30

Slide 30 text

ASK AGAIN LATER

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

The community changed the world.

Slide 33

Slide 33 text

Great new tools for the web, over time:

Slide 34

Slide 34 text

2005

Slide 35

Slide 35 text

2005

Slide 36

Slide 36 text

2006

Slide 37

Slide 37 text

2007

Slide 38

Slide 38 text

2008

Slide 39

Slide 39 text

2009

Slide 40

Slide 40 text

2010

Slide 41

Slide 41 text

2011

Slide 42

Slide 42 text

2011

Slide 43

Slide 43 text

2012

Slide 44

Slide 44 text

2013

Slide 45

Slide 45 text

2014

Slide 46

Slide 46 text

2014

Slide 47

Slide 47 text

Where are the best tools?

Slide 48

Slide 48 text

Ruby's tool ecosystem is mature, crowded Where are the best tools?

Slide 49

Slide 49 text

Ruby's tool ecosystem is mature, crowded Node's ecosystem is immature, innovative Where are the best tools?

Slide 50

Slide 50 text

Ruby's tool ecosystem is mature, crowded Node's ecosystem is immature, innovative Tool authors aren't immune to trends Where are the best tools?

Slide 51

Slide 51 text

Ruby's tool ecosystem is mature, crowded Node's ecosystem is immature, innovative Tool authors aren't immune to trends Tools address the problems of their day Where are the best tools?

Slide 52

Slide 52 text

Ruby's tool ecosystem is mature, crowded Node's ecosystem is immature, innovative Tool authors aren't immune to trends Tools address the problems of their day Where are the best tools?

Slide 53

Slide 53 text

Ruby's tool ecosystem is mature, crowded Node's ecosystem is immature, innovative Tool authors aren't immune to trends Tools address the problems of their day Node's web app tooling better solves today's problems Where are the best tools?

Slide 54

Slide 54 text

No content

Slide 55

Slide 55 text

Rails won the war.

Slide 56

Slide 56 text

Rails won the war? which

Slide 57

Slide 57 text

"Good frameworks are extractions, not inventions." - DHH

Slide 58

Slide 58 text

Basecamp

Slide 59

Slide 59 text

Basecamp

Slide 60

Slide 60 text

No content

Slide 61

Slide 61 text

Routing

Slide 62

Slide 62 text

Routing Models

Slide 63

Slide 63 text

Routing Models Persistence

Slide 64

Slide 64 text

Routing Models Persistence Sessions

Slide 65

Slide 65 text

Routing Models Persistence Sessions Mailers

Slide 66

Slide 66 text

Routing Models Persistence Sessions Mailers JavaScript Alternatives

Slide 67

Slide 67 text

Routing Models Persistence Sessions Mailers AJAX ERB Tags

Slide 68

Slide 68 text

Routing Models Persistence Sessions Mailers RJS

Slide 69

Slide 69 text

Routing Models Persistence Sessions Mailers AJAX ERB Tags Unobtrusive

Slide 70

Slide 70 text

Routing Models Persistence Sessions Mailers Turbolinks

Slide 71

Slide 71 text

Basecamp

Slide 72

Slide 72 text

Basecamp

Slide 73

Slide 73 text

Basecamp

Slide 74

Slide 74 text

HTML UI

Slide 75

Slide 75 text

HTML UI ! Item 1

Slide 76

Slide 76 text

HTML UI ! Item 1 !

Slide 77

Slide 77 text

JavaScript UI

Slide 78

Slide 78 text

JavaScript UI ! new ItemView('#items').render()

Slide 79

Slide 79 text

JavaScript UI ! new ItemView('#items').render() ! $('button').click(function(e){ $('.alert').text('Thanks!').show() });

Slide 80

Slide 80 text

HTML UI ! app ├── controllers │ └── items_controller.rb ├── models │ └── item.rb └── views └── items └── index.html.erb

Slide 81

Slide 81 text

HTML UI ! app ├── controllers │ └── items_controller.rb ├── models │ └── item.rb ├── views │ └── items │ └── index.html.erb └── assets └── javascripts └── application.js

Slide 82

Slide 82 text

HTML UI + JS UI ! app ├── controllers │ └── items_controller.rb ├── models │ └── item.rb ├── views │ └── items │ └── index.html.erb └── assets └── javascripts └── more_app ├── controllers │ └── items_controller.js ├── models │ └── item.js └── views └── items └── index.jst.ejs

Slide 83

Slide 83 text

HTML UI + JS UI ! app ├── controllers │ └── items_controller.rb ├── models │ └── item.rb ├── views │ └── items │ └── index.html.erb └── assets └── javascripts └── more_app ├── controllers │ └── items_controller.js ├── models │ └── item.js └── views └── items └── index.jst.ejs

Slide 84

Slide 84 text

HTML UI + JS UI ! app ├── controllers │ └── items_controller.rb ├── models │ └── item.rb ├── views │ └── items │ └── index.html.erb └── assets └── javascripts └── more_app ├── controllers │ └── items_controller.js ├── models │ └── item.js └── views └── items └── index.jst.ejs

Slide 85

Slide 85 text

HTML UI + JS UI ! app ├── controllers │ └── items_controller.rb ├── models │ └── item.rb ├── views │ └── items │ └── index.html.erb └── assets └── javascripts └── more_app ├── controllers │ └── items_controller.js ├── models │ └── item.js └── views └── items └── index.jst.ejs

Slide 86

Slide 86 text

JSON API + JS UI ! app ├── controllers │ └── items_controller.rb ├── models │ └── item.rb │ │ │ └── assets └── javascripts └── more_app ├── controllers │ └── items_controller.js ├── models │ └── item.js └── views └── items └── index.jst.ejs

Slide 87

Slide 87 text

JSON API + JS UI ! app ├── controllers │ └── items_controller.rb ├── models │ └── item.rb │ │ │ └── assets └── javascripts └── more_app ├── controllers │ └── items_controller.js ├── models │ └── item.js └── views └── items └── index.jst.ejs

Slide 88

Slide 88 text

JSON API + JS UI ! app ├── controllers │ └── items_controller.rb ├── models │ └── item.rb │ │ │ └── assets └── javascripts └── more_app ├── controllers │ └── items_controller.js ├── models │ └── item.js └── views └── items └── index.jst.ejs vestigial appendage

Slide 89

Slide 89 text

what's wrong with that vestigial appendage?

Slide 90

Slide 90 text

app/

Slide 91

Slide 91 text

app/

Slide 92

Slide 92 text

app/

Slide 93

Slide 93 text

app/

Slide 94

Slide 94 text

ap

Slide 95

Slide 95 text

ap

Slide 96

Slide 96 text

ap p/

Slide 97

Slide 97 text

app1/ ! app2/

Slide 98

Slide 98 text

app1/ ! app2/

Slide 99

Slide 99 text

app1/ ! app2/

Slide 100

Slide 100 text

app1/ ! app2/

Slide 101

Slide 101 text

app1

Slide 102

Slide 102 text

app1

Slide 103

Slide 103 text

app1 app2

Slide 104

Slide 104 text

late extraction costs more than early abstraction

Slide 105

Slide 105 text

No content

Slide 106

Slide 106 text

No content

Slide 107

Slide 107 text

No content

Slide 108

Slide 108 text

No content

Slide 109

Slide 109 text

No content

Slide 110

Slide 110 text

No content

Slide 111

Slide 111 text

No content

Slide 112

Slide 112 text

If you see this:

Slide 113

Slide 113 text

If you see this: !

Slide 114

Slide 114 text

If you see this: ! user = <%= user.to_json %>

Slide 115

Slide 115 text

If you see this: ! user = <%= user.to_json %> time = <%= Time.now.to_i %>

Slide 116

Slide 116 text

If you see this: ! user = <%= user.to_json %> time = <%= Time.now.to_i %> items = <%= items.to_json %>

Slide 117

Slide 117 text

If you see this: ! user = <%= user.to_json %> time = <%= Time.now.to_i %> items = <%= items.to_json %> token = "<%= @token %>"

Slide 118

Slide 118 text

! user = <%= user.to_json %> time = <%= Time.now.to_i %> items = <%= items.to_json %> token = "<%= @token %>" Your yarn is tangled

Slide 119

Slide 119 text

late extraction costs more than early abstraction

Slide 120

Slide 120 text

JavaScript made easy.

Slide 121

Slide 121 text

App Framework Convention & Config Build Automation

Slide 122

Slide 122 text

Rails App Framework Convention & Config Build Automation

Slide 123

Slide 123 text

Rails Rails App Framework Convention & Config Build Automation

Slide 124

Slide 124 text

Rails Rails Railsy Rake App Framework Convention & Config Build Automation

Slide 125

Slide 125 text

Rails Rails Railsy Rake App Framework Convention & Config Build Automation B-

Slide 126

Slide 126 text

Rails Rails Railsy Rake App Framework Convention & Config Build Automation B- A+

Slide 127

Slide 127 text

Rails Rails Railsy Rake App Framework Convention & Config Build Automation B+ B- A+

Slide 128

Slide 128 text

Rails Rails Railsy Rake App Framework Convention & Config Build Automation B+ B- A+

Slide 129

Slide 129 text

Rails Rails Railsy Rake App Framework Convention & Config Build Automation

Slide 130

Slide 130 text

Rails Rails Railsy Rake App Framework Convention & Config Build Automation Backbone

Slide 131

Slide 131 text

Rails Rails Railsy Rake App Framework Convention & Config Build Automation Backbone Ember

Slide 132

Slide 132 text

Rails Rails Railsy Rake App Framework Convention & Config Build Automation Backbone Ember Angular

Slide 133

Slide 133 text

Rails Rails Railsy Rake App Framework Convention & Config Build Automation Backbone Ember Angular ᵇ(´-ʆ)ᵃ


Slide 134

Slide 134 text

Rails Rails Railsy Rake App Framework Convention & Config Build Automation Node.js (Grunt) Backbone Ember Angular ᵇ(´-ʆ)ᵃ


Slide 135

Slide 135 text

Rails Rails Railsy Rake App Framework Convention & Config Build Automation Node.js (Grunt) ??? Backbone Ember Angular ᵇ(´-ʆ)ᵃ


Slide 136

Slide 136 text

Rails Rails Railsy Rake App Framework Convention & Config Build Automation Node.js (Grunt) Lineman Backbone Ember Angular ᵇ(´-ʆ)ᵃ


Slide 137

Slide 137 text

@linemanjs linemanjs.com

Slide 138

Slide 138 text

! $ npm install -g lineman Install

Slide 139

Slide 139 text

! $ npm install -g lineman Install ! $ lineman new my-app Create

Slide 140

Slide 140 text

No content

Slide 141

Slide 141 text

No content

Slide 142

Slide 142 text

hi() code

Slide 143

Slide 143 text

hi() code ! save

Slide 144

Slide 144 text

hi() code ! save loadTask = (module) -> if fs.existsSync("#{process.cwd()}/node_modules/#{module}") grunt.loadNpmTasks(module) else grunt.loadTasks("#{__dirname}/../node_modules/#{module}/ tasks") npmTasks = grunt.util._(linemanNpmTasks).chain(). union("grunt-contrib-sass" if config.enableSass). union(config.loadNpmTasks). compact().value() loadTask task for task in npmTasks grunt.renameTask "copy", "images" loadTask "grunt-contrib-copy" # load again so webfonts can use it grunt.renameTask "copy", "webfonts" loadTask "grunt-contrib-copy" # load again to make available in userland compile

Slide 145

Slide 145 text

hi() code ! save loadTask = (module) -> if fs.existsSync("#{process.cwd()}/node_modules/#{module}") grunt.loadNpmTasks(module) else grunt.loadTasks("#{__dirname}/../node_modules/#{module}/ tasks") npmTasks = grunt.util._(linemanNpmTasks).chain(). union("grunt-contrib-sass" if config.enableSass). union(config.loadNpmTasks). compact().value() loadTask task for task in npmTasks grunt.renameTask "copy", "images" loadTask "grunt-contrib-copy" # load again so webfonts can use it grunt.renameTask "copy", "webfonts" loadTask "grunt-contrib-copy" # load again to make available in userland compile loadTask task for task in npmTasks grunt.renameTask "copy", "images" loadTask "grunt-contrib-copy" # load again so webfonts can use it grunt.renameTask "copy", "webfonts" loadTask "grunt-contrib-copy" # load again to make available in userland loadTask = (module) -> if fs.existsSync("#{process.cwd()}/node_modules/#{module}") grunt.loadNpmTasks(module) else grunt.loadTasks("#{__dirname}/../node_modules/#{module}/tasks") npmTasks = grunt.util._(linemanNpmTasks).chain(). union("grunt-contrib-sass" if config.enableSass). union(config.loadNpmTasks). compact().value() concat

Slide 146

Slide 146 text

hi() code ! save loadTask = (module) -> if fs.existsSync("#{process.cwd()}/node_modules/#{module}") grunt.loadNpmTasks(module) else grunt.loadTasks("#{__dirname}/../node_modules/#{module}/ tasks") npmTasks = grunt.util._(linemanNpmTasks).chain(). union("grunt-contrib-sass" if config.enableSass). union(config.loadNpmTasks). compact().value() loadTask task for task in npmTasks grunt.renameTask "copy", "images" loadTask "grunt-contrib-copy" # load again so webfonts can use it grunt.renameTask "copy", "webfonts" loadTask "grunt-contrib-copy" # load again to make available in userland compile loadTask task for task in npmTasks grunt.renameTask "copy", "images" loadTask "grunt-contrib-copy" # load again so webfonts can use it grunt.renameTask "copy", "webfonts" loadTask "grunt-contrib-copy" # load again to make available in userland loadTask = (module) -> if fs.existsSync("#{process.cwd()}/node_modules/#{module}") grunt.loadNpmTasks(module) else grunt.loadTasks("#{__dirname}/../node_modules/#{module}/tasks") npmTasks = grunt.util._(linemanNpmTasks).chain(). union("grunt-contrib-sass" if config.enableSass). union(config.loadNpmTasks). compact().value() concat hello world! play

Slide 147

Slide 147 text

< 100ms hi() code ! save loadTask = (module) -> if fs.existsSync("#{process.cwd()}/node_modules/#{module}") grunt.loadNpmTasks(module) else grunt.loadTasks("#{__dirname}/../node_modules/#{module}/ tasks") npmTasks = grunt.util._(linemanNpmTasks).chain(). union("grunt-contrib-sass" if config.enableSass). union(config.loadNpmTasks). compact().value() loadTask task for task in npmTasks grunt.renameTask "copy", "images" loadTask "grunt-contrib-copy" # load again so webfonts can use it grunt.renameTask "copy", "webfonts" loadTask "grunt-contrib-copy" # load again to make available in userland compile loadTask task for task in npmTasks grunt.renameTask "copy", "images" loadTask "grunt-contrib-copy" # load again so webfonts can use it grunt.renameTask "copy", "webfonts" loadTask "grunt-contrib-copy" # load again to make available in userland loadTask = (module) -> if fs.existsSync("#{process.cwd()}/node_modules/#{module}") grunt.loadNpmTasks(module) else grunt.loadTasks("#{__dirname}/../node_modules/#{module}/tasks") npmTasks = grunt.util._(linemanNpmTasks).chain(). union("grunt-contrib-sass" if config.enableSass). union(config.loadNpmTasks). compact().value() concat hello world! play

Slide 148

Slide 148 text

No content

Slide 149

Slide 149 text

< 100ms hi() code ! save loadTask = (module) -> if fs.existsSync("#{process.cwd()}/node_modules/#{module}") grunt.loadNpmTasks(module) else grunt.loadTasks("#{__dirname}/../node_modules/#{module}/ tasks") npmTasks = grunt.util._(linemanNpmTasks).chain(). union("grunt-contrib-sass" if config.enableSass). union(config.loadNpmTasks). compact().value() loadTask task for task in npmTasks grunt.renameTask "copy", "images" loadTask "grunt-contrib-copy" # load again so webfonts can use it grunt.renameTask "copy", "webfonts" loadTask "grunt-contrib-copy" # load again to make available in userland compile loadTask task for task in npmTasks grunt.renameTask "copy", "images" loadTask "grunt-contrib-copy" # load again so webfonts can use it grunt.renameTask "copy", "webfonts" loadTask "grunt-contrib-copy" # load again to make available in userland loadTask = (module) -> if fs.existsSync("#{process.cwd()}/node_modules/#{module}") grunt.loadNpmTasks(module) else grunt.loadTasks("#{__dirname}/../node_modules/#{module}/tasks") npmTasks = grunt.util._(linemanNpmTasks).chain(). union("grunt-contrib-sass" if config.enableSass). union(config.loadNpmTasks). compact().value() concat hello world! play

Slide 150

Slide 150 text

hi() code ! save loadTask = (module) -> if fs.existsSync("#{process.cwd()}/node_modules/#{module}") grunt.loadNpmTasks(module) else grunt.loadTasks("#{__dirname}/../node_modules/#{module}/ tasks") npmTasks = grunt.util._(linemanNpmTasks).chain(). union("grunt-contrib-sass" if config.enableSass). union(config.loadNpmTasks). compact().value() loadTask task for task in npmTasks grunt.renameTask "copy", "images" loadTask "grunt-contrib-copy" # load again so webfonts can use it grunt.renameTask "copy", "webfonts" loadTask "grunt-contrib-copy" # load again to make available in userland compile loadTask task for task in npmTasks grunt.renameTask "copy", "images" loadTask "grunt-contrib-copy" # load again so webfonts can use it grunt.renameTask "copy", "webfonts" loadTask "grunt-contrib-copy" # load again to make available in userland loadTask = (module) -> if fs.existsSync("#{process.cwd()}/node_modules/#{module}") grunt.loadNpmTasks(module) else grunt.loadTasks("#{__dirname}/../node_modules/#{module}/tasks") npmTasks = grunt.util._(linemanNpmTasks).chain(). union("grunt-contrib-sass" if config.enableSass). union(config.loadNpmTasks). compact().value() concat test < 100ms

Slide 151

Slide 151 text

No content

Slide 152

Slide 152 text

Can your server host static files?

Slide 153

Slide 153 text

! $ lineman build !

Slide 154

Slide 154 text

! $ lineman build ! $ tree dist

Slide 155

Slide 155 text

! $ lineman build ! $ tree dist ! dist ├── css │ └── app.css ├── index.html └── js └── app.js

Slide 156

Slide 156 text

! $ lineman build ! $ tree dist ! dist ├── assets.json ├── css │ └── app-6193b1f500c0f944db0354592.css ├── index.html └── js └── app-8b750b723eae24580f7d757f62.js

Slide 157

Slide 157 text

! $ heroku config:set BUILDPACK_URL=http://github.com/ testdouble/heroku-buildpack-lineman.git ! $ git push Heroku

Slide 158

Slide 158 text

! $ heroku config:set BUILDPACK_URL=http://github.com/ testdouble/heroku-buildpack-lineman.git ! $ git push Heroku Builds with Node.js

Slide 159

Slide 159 text

! $ heroku config:set BUILDPACK_URL=http://github.com/ testdouble/heroku-buildpack-lineman.git ! $ git push Heroku Builds with Node.js Runs without Node.js

Slide 160

Slide 160 text

Starter Projects

Slide 161

Slide 161 text

angular Starter Projects

Slide 162

Slide 162 text

backbone angular Starter Projects

Slide 163

Slide 163 text

ember backbone angular Starter Projects

Slide 164

Slide 164 text

ember backbone angular web libs Starter Projects

Slide 165

Slide 165 text

ember backbone angular web libs markdown blogs Starter Projects

Slide 166

Slide 166 text

easy extensions

Slide 167

Slide 167 text

! $ npm install --save-dev lineman-bower ! zero-config plugins

Slide 168

Slide 168 text

! $ npm install --save-dev lineman-bower ! $ lineman run ! zero-config plugins

Slide 169

Slide 169 text

! $ npm install --save-dev lineman-bower ! $ lineman run ! ... Running "bower:install" (bower) task >> Installed bower packages ... zero-config plugins

Slide 170

Slide 170 text

No content

Slide 171

Slide 171 text

Grunt

Slide 172

Slide 172 text

} Make Cmake Rake Ant / NAnt MSBuild Maven Grunt

Slide 173

Slide 173 text

grunt-contrib-clean grunt-contrib-coffee grunt-contrib-concat grunt-contrib-copy grunt-contrib-handlebars grunt-contrib-jshint grunt-contrib-jst grunt-contrib-less grunt-contrib-sass grunt-contrib-cssmin grunt-contrib-uglify grunt-watch-nospawn grunt-contrib-imagemin grunt-jasmine-bundle grunt-contrib-compass

Slide 174

Slide 174 text

grunt-contrib-clean grunt-contrib-coffee grunt-contrib-concat grunt-contrib-copy grunt-contrib-handlebars grunt-contrib-jshint grunt-contrib-jst grunt-contrib-less grunt-contrib-sass grunt-contrib-cssmin grunt-contrib-uglify grunt-watch-nospawn grunt-contrib-imagemin grunt-jasmine-bundle grunt-contrib-compass grunt-*

Slide 175

Slide 175 text

No content

Slide 176

Slide 176 text

No content

Slide 177

Slide 177 text

Client Server

Slide 178

Slide 178 text

Client Server ?

Slide 179

Slide 179 text

Client Server

Slide 180

Slide 180 text

Client Server

Slide 181

Slide 181 text

Client Server

Slide 182

Slide 182 text

Lineman Sinatra

Slide 183

Slide 183 text

Lineman Sinatra

Slide 184

Slide 184 text

Lineman Sinatra

Slide 185

Slide 185 text

Lineman Sinatra

Slide 186

Slide 186 text

Lineman Sinatra

Slide 187

Slide 187 text

No content

Slide 188

Slide 188 text

Client Server

Slide 189

Slide 189 text

Client Server

Slide 190

Slide 190 text

Client Server

Slide 191

Slide 191 text

Client Server

Slide 192

Slide 192 text

Lineman Sinatra

Slide 193

Slide 193 text

Lineman Sinatra

Slide 194

Slide 194 text

Lineman Sinatra

Slide 195

Slide 195 text

Lineman Sinatra

Slide 196

Slide 196 text

No content

Slide 197

Slide 197 text

30 minute test build

Slide 198

Slide 198 text

No content

Slide 199

Slide 199 text

4 minutes

Slide 200

Slide 200 text

4 minutes 4 minutes +

Slide 201

Slide 201 text

4 minutes 4 minutes + + 2 minutes

Slide 202

Slide 202 text

4 minutes 4 minutes + + 2 minutes 10 minute test build

Slide 203

Slide 203 text

It's habit forming.

Slide 204

Slide 204 text

It's habit forming.

Slide 205

Slide 205 text

It's habit forming.

Slide 206

Slide 206 text

No content

Slide 207

Slide 207 text

linemanjs.com/rails.html

Slide 208

Slide 208 text

No content

Slide 209

Slide 209 text

My name is Justin Searls Please tweet me @searls & Say [email protected]

Slide 210

Slide 210 text

noun project attribution Yarn designed by Marie Coons from The Noun Project! ! Scale designed by Ritika Khasgiwale from The Noun Project