Top Banner
Bridging The GAP
91

Darcy Laycock. Bridging the gap

May 09, 2015

Download

Technology

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Darcy Laycock. Bridging the gap

Bridging

The GAP

Page 2: Darcy Laycock. Bridging the gap

I’m Darcy.

Page 3: Darcy Laycock. Bridging the gap

@sutto

github.com/Sutto

[email protected]

Page 4: Darcy Laycock. Bridging the gap
Page 5: Darcy Laycock. Bridging the gap

Filter Squadhttp://github.com/filtersquad

Page 7: Darcy Laycock. Bridging the gap

cat ./README

• A brief History of JavaScript

• {Ruby,Rails} + JS Love

• Building Cool Stuff with ExecJS

Page 8: Darcy Laycock. Bridging the gap

Most Importantly,

Becoming a Better Ruby

Developer With

JavaScript

Page 9: Darcy Laycock. Bridging the gap

A short History of JavaScript

Act 1

Page 10: Darcy Laycock. Bridging the gap

Created by Brendan Eich

in 1995 at Netscape

Page 11: Darcy Laycock. Bridging the gap

Prototype Based

Dynamic & Weak Typing

Functions are First Class

Page 12: Darcy Laycock. Bridging the gap

~1996 until ~2004

The Browser Wars &

The DHTML Years

Page 13: Darcy Laycock. Bridging the gap
Page 14: Darcy Laycock. Bridging the gap

~2004 until ~2008

AJAX and Web 2.0

Page 15: Darcy Laycock. Bridging the gap
Page 16: Darcy Laycock. Bridging the gap

~2008 to Now

HTML5 & The Return

to the Server Side

Page 17: Darcy Laycock. Bridging the gap

0.1.0 Released Late 2009

Page 18: Darcy Laycock. Bridging the gap

Server Side JS isn’t New.

Page 19: Darcy Laycock. Bridging the gap
Page 20: Darcy Laycock. Bridging the gap

1996: NetScape LiveWire

1997: Rhino created

1997: JScript via ASP

2000: JScript.NET

Page 21: Darcy Laycock. Bridging the gap

2005: Helma released

2007: AppJet Launched

2008: Aptana Jaxer hits 1.0

2009: Node.JS Released

Page 22: Darcy Laycock. Bridging the gap

JavaScript and I

Act 2

Page 23: Darcy Laycock. Bridging the gap

Mid 2008:

I started writing an IRC Bot

Page 24: Darcy Laycock. Bridging the gap
Page 25: Darcy Laycock. Bridging the gap

Bright Idea:

JavaScript Plugins

Page 26: Darcy Laycock. Bridging the gap
Page 27: Darcy Laycock. Bridging the gap

Client in Ruby,

Plugins in JavaScript

Page 28: Darcy Laycock. Bridging the gap

Early 2010:

I discovered CoffeeScript

Page 29: Darcy Laycock. Bridging the gap
Page 30: Darcy Laycock. Bridging the gap
Page 31: Darcy Laycock. Bridging the gap
Page 32: Darcy Laycock. Bridging the gap

“Simple, transparent CoffeeScript support

for Rails and Rack Apps”.

Page 33: Darcy Laycock. Bridging the gap

The Gap

Act 3

Page 34: Darcy Laycock. Bridging the gap
Page 35: Darcy Laycock. Bridging the gap

Ruby JavaScript

Page 36: Darcy Laycock. Bridging the gap

Ruby JavaScript

Page 37: Darcy Laycock. Bridging the gap

Ruby JavaScriptBridgingThe Gap

Page 38: Darcy Laycock. Bridging the gap

Client Side

Act 4

Page 39: Darcy Laycock. Bridging the gap

RJS

Page 40: Darcy Laycock. Bridging the gap
Page 41: Darcy Laycock. Bridging the gap

Red + RedShifthttps://github.com/jessesielaff/red/

Page 42: Darcy Laycock. Bridging the gap
Page 43: Darcy Laycock. Bridging the gap

HotRubyhttp://hotruby.yukoba.jp/

Page 44: Darcy Laycock. Bridging the gap
Page 46: Darcy Laycock. Bridging the gap
Page 47: Darcy Laycock. Bridging the gap

Unobtrusive RJS(Rails >= 3.0),

e.g. https://github.com/rails/jquery-ujs

Page 48: Darcy Laycock. Bridging the gap
Page 49: Darcy Laycock. Bridging the gap

CoffeeScript

Page 50: Darcy Laycock. Bridging the gap
Page 51: Darcy Laycock. Bridging the gap

http://lesscss.org/

Page 52: Darcy Laycock. Bridging the gap
Page 53: Darcy Laycock. Bridging the gap

Rails 3.1 Asset Pipeline

Page 54: Darcy Laycock. Bridging the gap

HandleBar / Mustache

Page 55: Darcy Laycock. Bridging the gap

Same template Code on Client & Server

Page 56: Darcy Laycock. Bridging the gap

Server Side

Act 5

Page 57: Darcy Laycock. Bridging the gap

gem install coffee-script

Page 58: Darcy Laycock. Bridging the gap

0.1.0 until 0.3.2

Ruby-based Compiler

Page 59: Darcy Laycock. Bridging the gap

Barista + BistroCar

Call Library via Node

Page 60: Darcy Laycock. Bridging the gap

Gem Version ~> 1.0

Uses the gem ‘node’

Page 61: Darcy Laycock. Bridging the gap

Gem Version <= 2.2, >= 2.0

Built in Engines Approach

Page 62: Darcy Laycock. Bridging the gap

Gem Version ~> 2.2

Uses ExecJS instead

Page 63: Darcy Laycock. Bridging the gap

Baristahttps://github.com/sutto/barista/

Page 64: Darcy Laycock. Bridging the gap

ExecJShttps://github.com/sstephenson/execjs

Page 65: Darcy Laycock. Bridging the gap

therubyracer

therubyrhino

johnson

mustang

Page 66: Darcy Laycock. Bridging the gap

Apple JavaScript Core (JSC)

Mozilla Spidermonkey

Microsoft Windows Script Host

Node.js

Page 67: Darcy Laycock. Bridging the gap

Uses first available RunTime

Page 68: Darcy Laycock. Bridging the gap

Uglifierhttps://github.com/lautis/uglifier

Page 69: Darcy Laycock. Bridging the gap
Page 70: Darcy Laycock. Bridging the gap

Rails 3.1 Asset Pipeline

Page 71: Darcy Laycock. Bridging the gap
Page 72: Darcy Laycock. Bridging the gap

Building Stuff with ExecJS

Page 73: Darcy Laycock. Bridging the gap
Page 74: Darcy Laycock. Bridging the gap
Page 75: Darcy Laycock. Bridging the gap
Page 76: Darcy Laycock. Bridging the gap

RedJShttps://github.com/cowboyd/redjs

Page 77: Darcy Laycock. Bridging the gap

“Rspecs for a Ruby interface to javascript.”

Page 78: Darcy Laycock. Bridging the gap

Embedding vs.

Just Running Code

Page 79: Darcy Laycock. Bridging the gap
Page 80: Darcy Laycock. Bridging the gap
Page 81: Darcy Laycock. Bridging the gap

More Traditional Approaches

Page 82: Darcy Laycock. Bridging the gap

Juggernaut 2https://github.com/maccman/juggernaut

Page 83: Darcy Laycock. Bridging the gap
Page 84: Darcy Laycock. Bridging the gap

Ruby / Other Languages

Redis PubSub

Node.JS Server

Browser

Page 85: Darcy Laycock. Bridging the gap

Ruby / Other Languages

Redis PubSub

Node.JS Server

Browser

Page 86: Darcy Laycock. Bridging the gap

Ruby / Other Languages

Redis PubSub

Node.JS Server

Browser

Page 87: Darcy Laycock. Bridging the gap

Ruby / Other Languages

Redis PubSub

Node.JS Server

Browser

Page 88: Darcy Laycock. Bridging the gap

See Also: ZeroMQ

Page 89: Darcy Laycock. Bridging the gap

Conclusion

Page 90: Darcy Laycock. Bridging the gap

Thanks!

Page 91: Darcy Laycock. Bridging the gap

Questions?