Opal a new_hope
-
Upload
forrest-chang -
Category
Technology
-
view
3.661 -
download
0
description
Transcript of Opal a new_hope
Opal - a new hope
(for Ruby Programmers)Forrest Chang@fkchang2000
Sunday, November 10, 13
THIS PRESENTATION HAS BEEN RATED
RUBYR UNDER 17 REQUIRES ACCOMPANYING PARENT OR ADULT GUARDIAN
STRONG CODER HAPPINESS, COOLNESS,JOY AND LANGUAGE
FOR OPTIMUM VIEWING EXPERIENCE, PLEASE WAIT UNTIL THE TEXT HITS THE MIDDLE OF THE SCREEN
BEFORE READING (YOU’LL KNOW WHAT THIS MEANS
Sunday, November 10, 13
Sunday, November 10, 13
http://www.westhighlandmuseum.org.uk/wp-content/uploads/2010/11/Show-of-hands.jpg
Sunday, November 10, 13
Who Works with the
?http://www.websailer.com/wp-content/uploads/2013/07/www_image.jpg
Sunday, November 10, 13
Who codes ruby
?http://www.slate.com/content/dam/slate/articles/technology/technology/2012/03/120307_FRESCA_whytheluckystiff.jpg.CROP.thumbnail-small.jpg
Sunday, November 10, 13
Who works with
?http://www.bigfunkychicken.com/pctz/sith.jpg
Sunday, November 10, 13
Who Likes ruby Better?
http://th08.deviantart.net/fs70/200H/f/2009/349/4/f/Screamy_and_Bee_love_Ruby__by_dark__romance.jpg
Sunday, November 10, 13
You
Are my targeT audience
Sunday, November 10, 13
everyone else is also welcome!
Sunday, November 10, 13
It is a time of Javascript Revolution
Sunday, November 10, 13
JS Everywhere!
Sunday, November 10, 13
JS Everywhere!
Desktops
Sunday, November 10, 13
JS Everywhere!
Desktops
Mobile
Sunday, November 10, 13
JS Everywhere!
Desktops
MobileBackend
Sunday, November 10, 13
Performance
http://images2.wikia.nocookie.net/__cb20101216021216/starwars/images/thumb/8/89/EmperorPalpatine-PoV.jpg/728px-EmperorPalpatine-PoV.jpg
Sunday, November 10, 13
Performance
V8 (Chrome, node)
http://images2.wikia.nocookie.net/__cb20101216021216/starwars/images/thumb/8/89/EmperorPalpatine-PoV.jpg/728px-EmperorPalpatine-PoV.jpg
Sunday, November 10, 13
Performance
V8 (Chrome, node)
Spidermonkey(ff)
http://images2.wikia.nocookie.net/__cb20101216021216/starwars/images/thumb/8/89/EmperorPalpatine-PoV.jpg/728px-EmperorPalpatine-PoV.jpg
Sunday, November 10, 13
Performance
V8 (Chrome, node)
Spidermonkey(ff)
carakan (oPERA)
http://images2.wikia.nocookie.net/__cb20101216021216/starwars/images/thumb/8/89/EmperorPalpatine-PoV.jpg/728px-EmperorPalpatine-PoV.jpg
Sunday, November 10, 13
Performance
V8 (Chrome, node)
Spidermonkey(ff)
carakan (oPERA)
chakra(ie)
http://images2.wikia.nocookie.net/__cb20101216021216/starwars/images/thumb/8/89/EmperorPalpatine-PoV.jpg/728px-EmperorPalpatine-PoV.jpg
Sunday, November 10, 13
libs/Frameworks
http://www.pulsarmedia.eu/data/media/26/Darth_Vader_3D_Wallpaper.jpg
Sunday, November 10, 13
libs/Frameworks
dom
http://www.pulsarmedia.eu/data/media/26/Darth_Vader_3D_Wallpaper.jpg
Sunday, November 10, 13
libs/Frameworks
dom
GUi
http://www.pulsarmedia.eu/data/media/26/Darth_Vader_3D_Wallpaper.jpg
Sunday, November 10, 13
libs/Frameworks
dom
GUi
MV****
http://www.pulsarmedia.eu/data/media/26/Darth_Vader_3D_Wallpaper.jpg
Sunday, November 10, 13
libs/Frameworks
dom
GUi
MV****
So Much more
http://www.pulsarmedia.eu/data/media/26/Darth_Vader_3D_Wallpaper.jpg
Sunday, November 10, 13
An exciting time
http://www.kiagarriques.com/wp-content/uploads/2013/02/excited.jpg
Sunday, November 10, 13
like it was for ruby in 2008
http://assets.en.oreilly.com/1/event/24/rails2009_home_photo1.jpg
Sunday, November 10, 13
problem
Sunday, November 10, 13
language is javascript
Sunday, November 10, 13
language is javascript
Sunday, November 10, 13
The language is javascript!
Sunday, November 10, 13
Sunday, November 10, 13
felt this way, you have?
“JAVASCRIPT IS THE PATH TO THE DARK SIDE. JAVASCRIPT LEADS TO ANGER. ANGER LEADS TO HATE. HATE LEADS TO SUFFERING.” - YODA, IF HE WERE A CODER
Sunday, November 10, 13
ruby == community of forward
thinking polyglots
Sunday, November 10, 13
can’t ignore the possibilities/opportunites
Sunday, November 10, 13
with all the momentum behind javascript
Sunday, November 10, 13
pressure TO ADOPT
Sunday, November 10, 13
feelS like this
Sunday, November 10, 13
feelS like this
Sunday, November 10, 13
no one wants to be destroyed
Sunday, November 10, 13
segue
Sunday, November 10, 13
matz on ruby
Sunday, November 10, 13
matz on ruby
"For me the purpose of life is partly to have joy. Programmers often feel joy when they can concentrate on the creative side of programming, So Ruby is designed to make programmers happy."
Sunday, November 10, 13
The purpose of Ruby
To make you happy
Sunday, November 10, 13
The purpose of Ruby
To make you happy
Sunday, November 10, 13
The Ruby Way
Sunday, November 10, 13
Not this
Sunday, November 10, 13
ultimately
Sunday, November 10, 13
the pitch
Sunday, November 10, 13
opal will make you happy
Sunday, November 10, 13
premise
Sunday, November 10, 13
ruby makes me happy
Sunday, November 10, 13
you too
Sunday, November 10, 13
opal is ruby
Sunday, November 10, 13
opal makes me happy
Sunday, November 10, 13
javascript makes me happy?
not as much
Sunday, November 10, 13
javascript makes me happy?
not as much
Sunday, November 10, 13
My opal journey -JDD
j oyDrivenDevelopment
Sunday, November 10, 13
My opal journey -JDD
j oyDrivenDevelopment
Sunday, November 10, 13
I don’t need Opal
Sunday, November 10, 13
I don’t need Opal
• in my job
Sunday, November 10, 13
I don’t need Opal
• in my job
• in my life
Sunday, November 10, 13
too much fun
Sunday, November 10, 13
too much fun
• can’t put it down
Sunday, November 10, 13
too much fun
• can’t put it down
• like a good book
Sunday, November 10, 13
SHARE
Sunday, November 10, 13
What is opal?
Sunday, November 10, 13
What is opal?
• Ruby to js source to source compiler, similar to coffeescript
Sunday, November 10, 13
What is opal?
• Ruby to js source to source compiler, similar to coffeescript
• small runtime (supports method missing, operator overloading, etc)
Sunday, November 10, 13
What is opal?
• Ruby to js source to source compiler, similar to coffeescript
• small runtime (supports method missing, operator overloading, etc)
• Ruby in the browser
Sunday, November 10, 13
Ruby in the browser
Sunday, November 10, 13
class Opal < Ruby include Browser::Access include Javascript::Interaction
runs_in :browser runs_in :node
makes_you :happyend
As Code
Sunday, November 10, 13
Sunday, November 10, 13
Sunday, November 10, 13
Switch gears
Sunday, November 10, 13
PAL SHOO W-2
Reasons Opal will make you happy
Sunday, November 10, 13
Sunday, November 10, 13
Reasons Opal will make you happy
Sunday, November 10, 13
1. It's just Ruby, and a viable one
Reasons Opal will make you happy
Sunday, November 10, 13
1. It's just Ruby, and a viable one
2. Greenspun's 10th Rule, Opal Edition
Reasons Opal will make you happy
Sunday, November 10, 13
1. It's just Ruby, and a viable one
2. Greenspun's 10th Rule, Opal Edition
3. Solves things the Ruby way, making the programmer happy
Reasons Opal will make you happy
Sunday, November 10, 13
1. It's just Ruby, and a viable one
2. Greenspun's 10th Rule, Opal Edition
3. Solves things the Ruby way, making the programmer happy
4. Frameworks, we don't need no stinking frameworks (but we have some)
Reasons Opal will make you happy
Sunday, November 10, 13
1. It's just Ruby, and a viable one
2. Greenspun's 10th Rule, Opal Edition
3. Solves things the Ruby way, making the programmer happy
4. Frameworks, we don't need no stinking frameworks (but we have some)
5. Tools you already know and love
Reasons Opal will make you happy
Sunday, November 10, 13
1. It's just Ruby, and a viable one
2. Greenspun's 10th Rule, Opal Edition
3. Solves things the Ruby way, making the programmer happy
4. Frameworks, we don't need no stinking frameworks (but we have some)
5. Tools you already know and love
6. Easy integration with Ruby web frameworks
Reasons Opal will make you happy
Sunday, November 10, 13
1. It's just Ruby, and a viable one
2. Greenspun's 10th Rule, Opal Edition
3. Solves things the Ruby way, making the programmer happy
4. Frameworks, we don't need no stinking frameworks (but we have some)
5. Tools you already know and love
6. Easy integration with Ruby web frameworks
7. Awesome In Browser tools
Reasons Opal will make you happy
Sunday, November 10, 13
1. It's just Ruby, and a viable one
2. Greenspun's 10th Rule, Opal Edition
3. Solves things the Ruby way, making the programmer happy
4. Frameworks, we don't need no stinking frameworks (but we have some)
5. Tools you already know and love
6. Easy integration with Ruby web frameworks
7. Awesome In Browser tools8. New possibilities
Reasons Opal will make you happy
Sunday, November 10, 13
1. It's just Ruby, and a viable one
Sunday, November 10, 13
1. It's just Ruby, and a viable one
• Question Number 1 - is opal a viable option?
Sunday, November 10, 13
1. It's just Ruby, and a viable one
• Question Number 1 - is opal a viable option?
• in production - 6 plus apps, 2 more coming soon
Sunday, November 10, 13
1. It's just Ruby, and a viable one
• Question Number 1 - is opal a viable option?
• in production - 6 plus apps, 2 more coming soon
• Biggest apps are the store and mobile sites for a High end fashion/luxury brand (client confidentiality agreement)
Sunday, November 10, 13
High End Fashion/Luxury Site
Sunday, November 10, 13
High End Fashion/Luxury Site
• globally
Sunday, November 10, 13
High End Fashion/Luxury Site
• globally
• ~2 million unique visitors/month
Sunday, November 10, 13
High End Fashion/Luxury Site
• globally
• ~2 million unique visitors/month
• ~20 Million page views/month
Sunday, November 10, 13
High End Fashion/Luxury Site
• globally
• ~2 million unique visitors/month
• ~20 Million page views/month
• Parts that involve opal
Sunday, November 10, 13
High End Fashion/Luxury Site
• globally
• ~2 million unique visitors/month
• ~20 Million page views/month
• Parts that involve opal
• store: ~2 million page views/month
Sunday, November 10, 13
High End Fashion/Luxury Site
• globally
• ~2 million unique visitors/month
• ~20 Million page views/month
• Parts that involve opal
• store: ~2 million page views/month
• mobile: ~2 million page views/month
Sunday, November 10, 13
High End Fashion/Luxury Site
• globally
• ~2 million unique visitors/month
• ~20 Million page views/month
• Parts that involve opal
• store: ~2 million page views/month
• mobile: ~2 million page views/month
• store is responsive, mobile works
Sunday, November 10, 13
High End Fashion/Luxury Site
• globally
• ~2 million unique visitors/month
• ~20 Million page views/month
• Parts that involve opal
• store: ~2 million page views/month
• mobile: ~2 million page views/month
• store is responsive, mobile works
• opal is not too heavy mobile devices
Sunday, November 10, 13
High End Fashion/Luxury Site
• globally
• ~2 million unique visitors/month
• ~20 Million page views/month
• Parts that involve opal
• store: ~2 million page views/month
• mobile: ~2 million page views/month
• store is responsive, mobile works
• opal is not too heavy mobile devices
• opal battle tested for ie8+, chrome, safari, firefox
Sunday, November 10, 13
1. It's just Ruby, and a viable one
Sunday, November 10, 13
1. It's just Ruby, and a viable one
• Real Ruby1.9.3 - compliant (mostly)
Sunday, November 10, 13
1. It's just Ruby, and a viable one
• Real Ruby1.9.3 - compliant (mostly)
• passes 2367 rubyspec examples - goal to pass all
Sunday, November 10, 13
1. It's just Ruby, and a viable one
• Real Ruby1.9.3 - compliant (mostly)
• passes 2367 rubyspec examples - goal to pass all
• capable of running complex ruby
Sunday, November 10, 13
1. It's just Ruby, and a viable one
• Real Ruby1.9.3 - compliant (mostly)
• passes 2367 rubyspec examples - goal to pass all
• capable of running complex ruby
• runs asciidoc gem unmodified
Sunday, November 10, 13
1. It's just Ruby, and a viable one
• Real Ruby1.9.3 - compliant (mostly)
• passes 2367 rubyspec examples - goal to pass all
• capable of running complex ruby
• runs asciidoc gem unmodified
• runs mspec gem unmodified,
Sunday, November 10, 13
1. It's just Ruby, and a viable one
• Real Ruby1.9.3 - compliant (mostly)
• passes 2367 rubyspec examples - goal to pass all
• capable of running complex ruby
• runs asciidoc gem unmodified
• runs mspec gem unmodified,
• rspec with some modification, primarily due to mutable strings
Sunday, November 10, 13
1. It's just Ruby, and a viable one
• Real Ruby1.9.3 - compliant (mostly)
• passes 2367 rubyspec examples - goal to pass all
• capable of running complex ruby
• runs asciidoc gem unmodified
• runs mspec gem unmodified,
• rspec with some modification, primarily due to mutable strings
• can compile itself
Sunday, November 10, 13
1. It's just Ruby, and a viable one
• Real Ruby1.9.3 - compliant (mostly)
• passes 2367 rubyspec examples - goal to pass all
• capable of running complex ruby
• runs asciidoc gem unmodified
• runs mspec gem unmodified,
• rspec with some modification, primarily due to mutable strings
• can compile itself
• much of stdlib in already in place
Sunday, November 10, 13
testimonials
Sunday, November 10, 13
Sunday, November 10, 13
Sunday, November 10, 13
Sunday, November 10, 13
“That guy”
Sunday, November 10, 13
“That guy”what does dhh
think?
Sunday, November 10, 13
TextDHH On Opal
Sunday, November 10, 13
TextDHH On Opal
Sunday, November 10, 13
TextDHH On Opal
Sunday, November 10, 13
**
Sunday, November 10, 13
Ruby language features in OPal
Sunday, November 10, 13
Ruby language features in OPal
• classes
• modules &and mixins
• singleton methods
• method-missing
• arity checks
• lambda
• blocks
• yield
• constants
• global variables
• class variables
• instance variables
Sunday, November 10, 13
More Ruby language features in OPal
• Basic object
• Kernel
• Nilclass
• range
• hash
• string interpolation
• heredocs
• %%w splits
Sunday, November 10, 13
don’t underestimate the power of a a better language
Sunday, November 10, 13
don’t underestimate the power of a a better language
• those who chose ruby for the backend know what i mean
Sunday, November 10, 13
don’t underestimate the power of a a better language
• those who chose ruby for the backend know what i mean
• opal-irb, opal-inspector easy to write, easy to read, little code *****
Sunday, November 10, 13
don’t underestimate the power of a a better language
• those who chose ruby for the backend know what i mean
• opal-irb, opal-inspector easy to write, easy to read, little code *****
• leads us to ...
Sunday, November 10, 13
2. Greenspun's 10th Rule, Opal Edition
Greenspun’s Rule
Sunday, November 10, 13
2. Greenspun's 10th Rule, Opal Edition
Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden,
slow implementation of half of Common Lisp.
Greenspun’s Rule
Sunday, November 10, 13
2. Greenspun's 10th Rule, Opal Edition
Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden,
slow implementation of half of Common Lisp.
Greenspun’s Rule
Sunday, November 10, 13
2. Greenspun's 10th Rule, Opal Edition
Greenspun’s Rule, Opal Edition
Sunday, November 10, 13
2. Greenspun's 10th Rule, Opal Edition
Any sufficiently complicated Javascript program contains an ad hoc, informally-specified, bug-ridden,
slow implementation of half of Ruby
Greenspun’s Rule, Opal Edition
Sunday, November 10, 13
greenspun in action
Sunday, November 10, 13
greenspun in action
Some attempts inspired by, trying to imitate ruby or emulating
ruby like features in JS
Sunday, November 10, 13
prototype
Sunday, November 10, 13
prototype
Sunday, November 10, 13
underscore
Sunday, November 10, 13
underscore
Sunday, November 10, 13
strukt
Sunday, November 10, 13
strukt
Sunday, November 10, 13
string.js
Sunday, November 10, 13
http://jsclass.jcoglan.com
Sunday, November 10, 13
http://jsclass.jcoglan.com
Sunday, November 10, 13
http://code.google.com/p/joose-js
Sunday, November 10, 13
http://code.google.com/p/joose-js
Sunday, November 10, 13
JavaScriptMVC
Sunday, November 10, 13
JavaScriptMVC
Sunday, November 10, 13
def.js
Sunday, November 10, 13
def.js
Sunday, November 10, 13
Sunday, November 10, 13
Sunday, November 10, 13
Raiya in Humax
Sunday, November 10, 13
Raiya in Humax
Sunday, November 10, 13
http://scatterpoll.com/#title-slide
Sunday, November 10, 13
http://scatterpoll.com/#title-slide
Sunday, November 10, 13
ActiveJS
Sunday, November 10, 13
ActiveJS
Sunday, November 10, 13
RedScript
Sunday, November 10, 13
RedScript
Sunday, November 10, 13
Forml
Sunday, November 10, 13
Forml
Sunday, November 10, 13
Other attempts to do Ruby in JS
Sunday, November 10, 13
people want ruby in the
browser
Sunday, November 10, 13
even if they don’t know it
Sunday, November 10, 13
some know they don’t want js
Sunday, November 10, 13
some know they don’t want js
Javascript...
It’s s**tI never use it
Sunday, November 10, 13
some know they don’t want js
Javascript...
It’s s**tI never use it
ripoff of the Smug DHH meme
Sunday, November 10, 13
instead of the adhoc, informally
specified, bug ridden, slow
implementation...
Sunday, November 10, 13
Opal
Sunday, November 10, 13
3. Solves things the Ruby way, making the programmer happy
Sunday, November 10, 13
3. Solves things the Ruby way, making the programmer happy
• could be its own presentation, only selected examples
Sunday, November 10, 13
3. Solves things the Ruby way, making the programmer happy
• could be its own presentation, only selected examples
• comparisons
Sunday, November 10, 13
3. Solves things the Ruby way, making the programmer happy
• could be its own presentation, only selected examples
• comparisons
• modular code
Sunday, November 10, 13
3. Solves things the Ruby way, making the programmer happy
• could be its own presentation, only selected examples
• comparisons
• modular code
• namespaces
Sunday, November 10, 13
3. Solves things the Ruby way, making the programmer happy
• could be its own presentation, only selected examples
• comparisons
• modular code
• namespaces
• external templates
Sunday, November 10, 13
3. Solves things the Ruby way, making the programmer happy
• could be its own presentation, only selected examples
• comparisons
• modular code
• namespaces
• external templates
• automation tasks
Sunday, November 10, 13
3. Solves things the Ruby way, making the programmer happy
• could be its own presentation, only selected examples
• comparisons
• modular code
• namespaces
• external templates
• automation tasks
• scope
Sunday, November 10, 13
3. Solves things the Ruby way, making the programmer happy
Sunday, November 10, 13
3. Solves things the Ruby way, making the programmer happy
• non comparision
Sunday, November 10, 13
3. Solves things the Ruby way, making the programmer happy
• non comparision
• dom
Sunday, November 10, 13
3. Solves things the Ruby way, making the programmer happy
• non comparision
• dom
• css
Sunday, November 10, 13
3. Solves things the Ruby way, making the programmer happy
• non comparision
• dom
• css
• javascript integration
Sunday, November 10, 13
3. Solves things the Ruby way, making the programmer happy
• non comparision
• dom
• css
• javascript integration
• testing
Sunday, November 10, 13
modular code: Javascript
Sunday, November 10, 13
modular code: Javascript
define( module_id /*optional*/, [dependencies] /*optional*/, definition function /*function for instantiating the module or object*/);// Consider 'foo' and 'bar' are two external modules// In this example, the 'exports' from the two modules loaded are passed as// function arguments to the callback (foo and bar)// so that they can similarly be accessed
Sunday, November 10, 13
modular code: Javascript
define( module_id /*optional*/, [dependencies] /*optional*/, definition function /*function for instantiating the module or object*/);// Consider 'foo' and 'bar' are two external modules// In this example, the 'exports' from the two modules loaded are passed as// function arguments to the callback (foo and bar)// so that they can similarly be accessed
require(['foo', 'bar'], function ( foo, bar ) { // rest of your code here foo.doSomething();});
Sunday, November 10, 13
modular code: Javascript
define( module_id /*optional*/, [dependencies] /*optional*/, definition function /*function for instantiating the module or object*/);// Consider 'foo' and 'bar' are two external modules// In this example, the 'exports' from the two modules loaded are passed as// function arguments to the callback (foo and bar)// so that they can similarly be accessed
require(['foo', 'bar'], function ( foo, bar ) { // rest of your code here foo.doSomething();});
Lots of other stuff
Sunday, November 10, 13
MODULAR CODE - ruby
Sunday, November 10, 13
MODULAR CODE - ruby
create a ruby file or gem
Sunday, November 10, 13
MODULAR CODE - ruby
require 'file_or_gem_you_want'
create a ruby file or gem
Sunday, November 10, 13
MODULAR CODE - Opal
Sunday, November 10, 13
MODULAR CODE - Opal
create a ruby file or gem
Sunday, November 10, 13
MODULAR CODE - Opal
require 'file_or_gem_you_want'
create a ruby file or gem
Sunday, November 10, 13
example from opal-irb
require 'opal'require 'opal-jquery'require 'opal-parser'require 'opal_irb_jqconsole'
Document.ready? do OpalIrbJqconsole.create("#console")end
Sunday, November 10, 13
example from opal-irb
require 'opal'require 'opal-jquery'require 'opal-parser'require 'opal_irb_jqconsole'
Document.ready? do OpalIrbJqconsole.create("#console")end
require gems
Sunday, November 10, 13
example from opal-irb
require 'opal'require 'opal-jquery'require 'opal-parser'require 'opal_irb_jqconsole'
Document.ready? do OpalIrbJqconsole.create("#console")end
require gems
require my file
Sunday, November 10, 13
example from opal-irb
require 'opal'require 'opal-jquery'require 'opal-parser'require 'opal_irb_jqconsole'
Document.ready? do OpalIrbJqconsole.create("#console")end
require gems
require my file
use it
Sunday, November 10, 13
Namespace - JS
Sunday, November 10, 13
Namespace - JS
• many ways
Sunday, November 10, 13
Namespace - JS
• many ways
• hand rolling nested objects
Sunday, November 10, 13
Namespace - JS
• many ways
• hand rolling nested objects
• namespace functions, self coded, Yui, Dojo
Sunday, November 10, 13
Namespace - JSby hand
or like this
Sunday, November 10, 13
Namespace - JS
Sunday, November 10, 13
Namespace - JSas a function
Sunday, November 10, 13
Namespace - JSas a function
function definition
Sunday, November 10, 13
namespace - ruby
• use module or class
Sunday, November 10, 13
namespace - opal
• use module or class
Sunday, November 10, 13
templates as external files: jsT
Sunday, November 10, 13
templates as external files: jsT
write jst template
Sunday, November 10, 13
templates as external files: jsT
write jst template
include in html
Sunday, November 10, 13
templates as external files: jsT
write jst template
include in html
use
Sunday, November 10, 13
templates as external files- Rails
• make external template file
• render # if you even have to
Sunday, November 10, 13
templates as external files -
• make external template file
• require “filename”
• Template[“filename”].render
Sunday, November 10, 13
automation tasks - js
Sunday, November 10, 13
automation tasks - js
• cake
Sunday, November 10, 13
automation tasks - js
• cake
• grunt
Sunday, November 10, 13
automation tasks - js
• cake
• grunt
• something new?
Sunday, November 10, 13
automation tasks - ruby
• rake
Sunday, November 10, 13
AUTOMATION TASKS -OPAL
• RAKE
Sunday, November 10, 13
scope - js
• wrap everything in a function
• while (i < 2) {
funcArray[i] = (function(value) { return function(){ alert(value); return false; } })(i); i++;}
Sunday, November 10, 13
scope - ruby
• much more flexible and sane rules
Sunday, November 10, 13
scope - opal
• see ruby
Sunday, November 10, 13
defer execution - js
• var immediateId = window.setImmediate(function() { code_you_want});
Sunday, November 10, 13
DEFER EXECUTION - opal-browser
• proc { code_you_want }.defer
Sunday, November 10, 13
javascript integration
Sunday, November 10, 13
javascript integration
• x-strings
Sunday, November 10, 13
javascript integration
• x-strings
• %x(window.location)
Sunday, November 10, 13
javascript integration
• x-strings
• %x(window.location)
• `window.location`
Sunday, November 10, 13
javascript integration
• x-strings
• %x(window.location)
• `window.location`
• used to have seemless bridging (via method missing) like jruby, now need to wrap objects with native
Sunday, November 10, 13
javascript integration
• x-strings
• %x(window.location)
• `window.location`
• used to have seemless bridging (via method missing) like jruby, now need to wrap objects with native
• @editor = Native(`CodeMirror.fromTextArea(areas)`)
Sunday, November 10, 13
DOM - opal-browser
Sunday, November 10, 13
DOM - opal-browser
create dom
Sunday, November 10, 13
DOM - opal-browser
create dom
get by id
Sunday, November 10, 13
DOM - opal-browser
create dom
get by id
ways to append
Sunday, November 10, 13
CSS opal-browser
Sunday, November 10, 13
CSS opal-browser
create css
Sunday, November 10, 13
CSS opal-browser
create css
append to head
Sunday, November 10, 13
Tests/Specs
Sunday, November 10, 13
3. Solves things the Ruby way, making the programmer happy
Sunday, November 10, 13
3. Solves things the Ruby way, making the programmer happy
• not done (but easy in ruby)
Sunday, November 10, 13
3. Solves things the Ruby way, making the programmer happy
• not done (but easy in ruby)
• monkey patching
Sunday, November 10, 13
3. Solves things the Ruby way, making the programmer happy
• not done (but easy in ruby)
• monkey patching
• method missing
Sunday, November 10, 13
4. Frameworks, we don't need no stinking frameworks
(but we have some)
Sunday, November 10, 13
4. Frameworks, we don't need no stinking frameworks
(but we have some)
Sunday, November 10, 13
4. Frameworks, we don't need no stinking frameworks
(but we have some)
• opal-irb, opal-inspector easy to write without a framework, very few lines
Sunday, November 10, 13
4. Frameworks, we don't need no stinking frameworks
(but we have some)
• opal-irb, opal-inspector easy to write without a framework, very few lines
• power of a better language
Sunday, November 10, 13
opal-inspector spike code
Sunday, November 10, 13
opal-inspector spike code
• 448 lines including whitespace and debugging lines
Sunday, November 10, 13
opal-inspector spike code
• 448 lines including whitespace and debugging lines
• mostly just plain ruby w/some opal-jquery
Sunday, November 10, 13
opal-inspector spike code
• 448 lines including whitespace and debugging lines
• mostly just plain ruby w/some opal-jquery
• selected code showN
Sunday, November 10, 13
Sunday, November 10, 13
Require gems
Sunday, November 10, 13
Require gems
Require tempates
Sunday, November 10, 13
Require gems
Require tempates
Render template
Sunday, November 10, 13
App setup
Sunday, November 10, 13
App setup
Add panes
Sunday, November 10, 13
App setup
Add panesjQuery stuff
Sunday, November 10, 13
4. Frameworks, we don't need no stinking frameworks
(but we have some)
Sunday, November 10, 13
4. Frameworks, we don't need no stinking frameworks
(but we have some)• while ruby is powerful by itself, opal have
some libs
Sunday, November 10, 13
4. Frameworks, we don't need no stinking frameworks
(but we have some)• while ruby is powerful by itself, opal have
some libs
• opal-jquery - jquery wrapped in a ruby way
Sunday, November 10, 13
4. Frameworks, we don't need no stinking frameworks
(but we have some)• while ruby is powerful by itself, opal have
some libs
• opal-jquery - jquery wrapped in a ruby way
• opal-browser - browser functionality
Sunday, November 10, 13
4. Frameworks, we don't need no stinking frameworks
(but we have some)• while ruby is powerful by itself, opal have
some libs
• opal-jquery - jquery wrapped in a ruby way
• opal-browser - browser functionality
• can use iN lieu of opal-jquery if you’re not using jquery
Sunday, November 10, 13
4. Frameworks, we don't need no stinking frameworks
(but we have some)• while ruby is powerful by itself, opal have
some libs
• opal-jquery - jquery wrapped in a ruby way
• opal-browser - browser functionality
• can use iN lieu of opal-jquery if you’re not using jquery
• vienna - MVC
Sunday, November 10, 13
4. Frameworks, we don't need no stinking frameworks
(but we have some)• while ruby is powerful by itself, opal have
some libs
• opal-jquery - jquery wrapped in a ruby way
• opal-browser - browser functionality
• can use iN lieu of opal-jquery if you’re not using jquery
• vienna - MVC
• lissio - MVC
Sunday, November 10, 13
5. Tools you already know and love
Sunday, November 10, 13
5. Tools you already know and love
• opal is Ruby
Sunday, November 10, 13
5. Tools you already know and love
• opal is Ruby• editor - emacs, textmate, vim,
sublime, Rubymine, etc.
Sunday, November 10, 13
5. Tools you already know and love
• opal is Ruby• editor - emacs, textmate, vim,
sublime, Rubymine, etc.• Rake
Sunday, November 10, 13
5. Tools you already know and love
• opal is Ruby• editor - emacs, textmate, vim,
sublime, Rubymine, etc.• Rake• rspec (sorry DHH)
Sunday, November 10, 13
5. Tools you already know and love
• opal is Ruby• editor - emacs, textmate, vim,
sublime, Rubymine, etc.• Rake• rspec (sorry DHH)• guard
Sunday, November 10, 13
5. Tools you already know and love
• opal is Ruby• editor - emacs, textmate, vim,
sublime, Rubymine, etc.• Rake• rspec (sorry DHH)• guard• <fill in the ruby tool> - remember it's just Ruby
Sunday, November 10, 13
5. Tools you already know and love
• opal is Ruby• editor - emacs, textmate, vim,
sublime, Rubymine, etc.• Rake• rspec (sorry DHH)• guard• <fill in the ruby tool> - remember it's just Ruby
• Reuse your ood and patterns Knowledge
Sunday, November 10, 13
Sunday, November 10, 13
6. Easy integration with Ruby web frameworks
Sunday, November 10, 13
6. Easy integration with Ruby web frameworks
• opal-rails
Sunday, November 10, 13
6. Easy integration with Ruby web frameworks
• opal-rails
• opal-sprockets
Sunday, November 10, 13
6. Easy integration with Ruby web frameworks
• opal-rails
• opal-sprockets
• opal-server
Sunday, November 10, 13
opal-rails
• The easy way
• rails new new_project --javascript=opal
Sunday, November 10, 13
opal-rails
Sunday, November 10, 13
opal-railsadd to gemfile
Sunday, November 10, 13
opal-railsadd to gemfile
add to APPLICATION.JS
Sunday, November 10, 13
opal-railsadd to gemfile
add to APPLICATION.JS
EDIT *.JS.RB FILE
Sunday, November 10, 13
opal-railsadd to gemfile
add to APPLICATION.JS
EDIT *.JS.RB FILE
HAML FILTERS SUPPORTED
Sunday, November 10, 13
opal-railsadd to gemfile
add to APPLICATION.JS
EDIT *.JS.RB FILE
HAML FILTERS SUPPORTED
add SPECS
Sunday, November 10, 13
opal-sprocketsFOR NON RAILS STANDALONE -
RAKEFILErequire 'bundler/setup'require 'opal'require 'opal-sprockets'
desc "build jqconsole based irb"task :build_jqconsole do
File.open("js/app-jqconsole.js", "w+") do |out| env = Opal::Environment.new env.append_path "examples" env.append_path "opal" out << env["app-jqconsole"].to_s end # system "terminal-notifier -title 'opal-irb build' -message 'js file built'" system "open -a 'Google Chrome' index-jq.html"end
Sunday, November 10, 13
opal-sprocketsFOR NON RAILS STANDALONE -
RAKEFILErequire 'bundler/setup'require 'opal'require 'opal-sprockets'
desc "build jqconsole based irb"task :build_jqconsole do
File.open("js/app-jqconsole.js", "w+") do |out| env = Opal::Environment.new env.append_path "examples" env.append_path "opal" out << env["app-jqconsole"].to_s end # system "terminal-notifier -title 'opal-irb build' -message 'js file built'" system "open -a 'Google Chrome' index-jq.html"end
file to write to
Sunday, November 10, 13
opal-sprocketsFOR NON RAILS STANDALONE -
RAKEFILErequire 'bundler/setup'require 'opal'require 'opal-sprockets'
desc "build jqconsole based irb"task :build_jqconsole do
File.open("js/app-jqconsole.js", "w+") do |out| env = Opal::Environment.new env.append_path "examples" env.append_path "opal" out << env["app-jqconsole"].to_s end # system "terminal-notifier -title 'opal-irb build' -message 'js file built'" system "open -a 'Google Chrome' index-jq.html"end
file to write to
append dirs to search
Sunday, November 10, 13
opal-sprocketsFOR NON RAILS STANDALONE -
RAKEFILErequire 'bundler/setup'require 'opal'require 'opal-sprockets'
desc "build jqconsole based irb"task :build_jqconsole do
File.open("js/app-jqconsole.js", "w+") do |out| env = Opal::Environment.new env.append_path "examples" env.append_path "opal" out << env["app-jqconsole"].to_s end # system "terminal-notifier -title 'opal-irb build' -message 'js file built'" system "open -a 'Google Chrome' index-jq.html"end
file to write to
append dirs to search
write contents
Sunday, November 10, 13
opal-server
Sunday, November 10, 13
opal-serveradd to gemfile
Sunday, November 10, 13
opal-serveradd to gemfile
create your opal file(s)
Sunday, November 10, 13
opal-serveradd to gemfile
create your opal file(s)
include application.js
Sunday, November 10, 13
opal-serveradd to gemfile
create your opal file(s)
include application.js
setup config.ru
Sunday, November 10, 13
opal-serveradd to gemfile
create your opal file(s)
include application.js
setup config.ru
rackup and refresh at will
Sunday, November 10, 13
7. Awesome In Browser tools
• opal-irb
• opal-inspector
Sunday, November 10, 13
opal-irb
Sunday, November 10, 13
opal-irb
• irb for opal
Sunday, November 10, 13
opal-irb
• irb for opal
• history
Sunday, November 10, 13
opal-irb
• irb for opal
• history
• readline controls (most)
Sunday, November 10, 13
opal-irb
• irb for opal
• history
• readline controls (most)
• popup multiline editor (works over all history)
Sunday, November 10, 13
opal-irb
• irb for opal
• history
• readline controls (most)
• popup multiline editor (works over all history)
• send a link (live gist)
Sunday, November 10, 13
opal-inspector
Sunday, November 10, 13
opal-inspector
• inspired by amber.js’s in browser smalltalk code browser
Sunday, November 10, 13
opal-inspector
• inspired by amber.js’s in browser smalltalk code browser
• persistent live opal objects is similar to the Smalltalk image
Sunday, November 10, 13
opal-inspector
• inspired by amber.js’s in browser smalltalk code browser
• persistent live opal objects is similar to the Smalltalk image
• change the paradigm of webapp development
Sunday, November 10, 13
opal-inspector
• inspired by amber.js’s in browser smalltalk code browser
• persistent live opal objects is similar to the Smalltalk image
• change the paradigm of webapp development
• develop in browser w/better tools
Sunday, November 10, 13
demos
Sunday, November 10, 13
opal-irb demo
• ruby
• invoke js
• multi line
• multi line edit
• dom example
• css example
• “live gist”
Sunday, November 10, 13
opal-inspector demo
• tabs overview
• show transcript
• class browser
• instance browser
Sunday, November 10, 13
OPAL-INSPECTOR
• WAiting on a feature from the opal parser to store code and comments
Sunday, November 10, 13
Sunday, November 10, 13
8. New possibilities
Sunday, November 10, 13
8. New possibilities
• in browser development
Sunday, November 10, 13
8. New possibilities
• in browser development
• change the development paradigm
Sunday, November 10, 13
8. New possibilities
• in browser development
• change the development paradigm
• take goodness from Smalltalk, ruby, lisp machines
Sunday, November 10, 13
8. New possibilities
• in browser development
• change the development paradigm
• take goodness from Smalltalk, ruby, lisp machines
• finally a standard Ui platform
Sunday, November 10, 13
8. New possibilities
• in browser development
• change the development paradigm
• take goodness from Smalltalk, ruby, lisp machines
• finally a standard Ui platform
• fragmented/stagnant before, gtk, wxwindows, qt, tk, etc.
Sunday, November 10, 13
8. New possibilities
• in browser development
• change the development paradigm
• take goodness from Smalltalk, ruby, lisp machines
• finally a standard Ui platform
• fragmented/stagnant before, gtk, wxwindows, qt, tk, etc.
• everyone has a browser
Sunday, November 10, 13
8. New possibilities
• in browser development
• change the development paradigm
• take goodness from Smalltalk, ruby, lisp machines
• finally a standard Ui platform
• fragmented/stagnant before, gtk, wxwindows, qt, tk, etc.
• everyone has a browser
• use these tools for backend too, ala better errors
Sunday, November 10, 13
8. New possibilities
• in browser development
• change the development paradigm
• take goodness from Smalltalk, ruby, lisp machines
• finally a standard Ui platform
• fragmented/stagnant before, gtk, wxwindows, qt, tk, etc.
• everyone has a browser
• use these tools for backend too, ala better errors
• better tooling for ruby across the board
Sunday, November 10, 13
8. New possibilities
Sunday, November 10, 13
8. New possibilities
• meteor.js like same code on front and back end
Sunday, November 10, 13
8. New possibilities
• meteor.js like same code on front and back end
• blurring the lines - vienna experiment
Sunday, November 10, 13
8. New possibilities
• meteor.js like same code on front and back end
• blurring the lines - vienna experiment
• eventd safe ruby libs
Sunday, November 10, 13
8. New possibilities
• meteor.js like same code on front and back end
• blurring the lines - vienna experiment
• eventd safe ruby libs
• as opal matures, eventd safe ruby libs/gems for both front and backend
Sunday, November 10, 13
8. New possibilities
Sunday, November 10, 13
8. New possibilities
• component based coding, all in one place for the web
Sunday, November 10, 13
8. New possibilities
• component based coding, all in one place for the web
• hard to do oo programming with markup and css
Sunday, November 10, 13
8. New possibilities
• component based coding, all in one place for the web
• hard to do oo programming with markup and css
• lissio - ruby class, all parts in ruby
Sunday, November 10, 13
8. New possibilities
• component based coding, all in one place for the web
• hard to do oo programming with markup and css
• lissio - ruby class, all parts in ruby
• html
Sunday, November 10, 13
8. New possibilities
• component based coding, all in one place for the web
• hard to do oo programming with markup and css
• lissio - ruby class, all parts in ruby
• html
• css
Sunday, November 10, 13
8. New possibilities
• component based coding, all in one place for the web
• hard to do oo programming with markup and css
• lissio - ruby class, all parts in ruby
• html
• css
• behavior
Sunday, November 10, 13
Sunday, November 10, 13
behavior
Sunday, November 10, 13
behavior
element
Sunday, November 10, 13
behavior
element
html
Sunday, November 10, 13
behavior
element
html
css
Sunday, November 10, 13
behavior
element
html
css
all ruby
Sunday, November 10, 13
nested css
Sunday, November 10, 13
8. New possibilities
Sunday, November 10, 13
8. New possibilities
• can you imagine a world w/o ruby?
Sunday, November 10, 13
8. New possibilities
• can you imagine a world w/o ruby?
• possible w/the javascript revolution
Sunday, November 10, 13
8. New possibilities
• can you imagine a world w/o ruby?
• possible w/the javascript revolution
• facilitate the fantasy land of ruby everywhere
Sunday, November 10, 13
8. New possibilities
• can you imagine a world w/o ruby?
• possible w/the javascript revolution
• facilitate the fantasy land of ruby everywhere
• backend mri, jruby, rubinius
Sunday, November 10, 13
8. New possibilities
• can you imagine a world w/o ruby?
• possible w/the javascript revolution
• facilitate the fantasy land of ruby everywhere
• backend mri, jruby, rubinius
• mirah - everywhere jvm runs
Sunday, November 10, 13
8. New possibilities
• can you imagine a world w/o ruby?
• possible w/the javascript revolution
• facilitate the fantasy land of ruby everywhere
• backend mri, jruby, rubinius
• mirah - everywhere jvm runs
• embedded mruby
Sunday, November 10, 13
8. New possibilities
• can you imagine a world w/o ruby?
• possible w/the javascript revolution
• facilitate the fantasy land of ruby everywhere
• backend mri, jruby, rubinius
• mirah - everywhere jvm runs
• embedded mruby
• mobile
Sunday, November 10, 13
8. New possibilities
• can you imagine a world w/o ruby?
• possible w/the javascript revolution
• facilitate the fantasy land of ruby everywhere
• backend mri, jruby, rubinius
• mirah - everywhere jvm runs
• embedded mruby
• mobile
• rubymotion
Sunday, November 10, 13
8. New possibilities
• can you imagine a world w/o ruby?
• possible w/the javascript revolution
• facilitate the fantasy land of ruby everywhere
• backend mri, jruby, rubinius
• mirah - everywhere jvm runs
• embedded mruby
• mobile
• rubymotion
• mobiruby
Sunday, November 10, 13
8. New possibilities
• can you imagine a world w/o ruby?
• possible w/the javascript revolution
• facilitate the fantasy land of ruby everywhere
• backend mri, jruby, rubinius
• mirah - everywhere jvm runs
• embedded mruby
• mobile
• rubymotion
• mobiruby
• opal - everywhere javascript runs
Sunday, November 10, 13
(dubious) history as starwars
films
Sunday, November 10, 13
Episode 1: The Phantom JS Menace
Mesa use Javascript on the backend!Mesa use Javascript everywhere!!!!
Mesa use Javascript in ways unintended...
Sunday, November 10, 13
Episode 2: Attack of the Clones
Coffescript
Typescript DartJSX Fantom
Sunday, November 10, 13
Episode 3: Revenge of the Sith
http://conquent.com/bissellator/blogimg/darth_gates.jpg
Windows 8 development using Javascript.Evil Empire complete
Sunday, November 10, 13
Episode 4: A New Hope
OPAL Wan Kenobi,you’re my only hope
Sunday, November 10, 13
Episode 5: The Empire Strikes Back
Join us, we have Ecmascript 6
Sunday, November 10, 13
Episode 6: Return of the Jedi
Opal Viable, New Deathstar explodes
Sunday, November 10, 13
Episode 7: TBD
http://www.copywritematters.com.au/dev/wp-content/uploads/2011/09/Lady-Pointing-To-You-Small-.jpg
Sunday, November 10, 13
Episode 7: TBD
http://www.copywritematters.com.au/dev/wp-content/uploads/2011/09/Lady-Pointing-To-You-Small-.jpg
Sunday, November 10, 13
Sunday, November 10, 13
Call to arms
Sunday, November 10, 13
Call to arms
• hope for momentum like rubinius
Sunday, November 10, 13
Call to arms
• hope for momentum like rubinius
• rubyconf 06 - just an idea
Sunday, November 10, 13
Call to arms
• hope for momentum like rubinius
• rubyconf 06 - just an idea
• rubyconf 07 - a movement
Sunday, November 10, 13
Call to arms
• hope for momentum like rubinius
• rubyconf 06 - just an idea
• rubyconf 07 - a movement
• opal is farther along, if we could make similar progress...
Sunday, November 10, 13
right now
Sunday, November 10, 13
right now
• things are pretty good
Sunday, November 10, 13
right now
• things are pretty good
• things could be better
Sunday, November 10, 13
right now
• things are pretty good
• things could be better
• more ruby compatibility
Sunday, November 10, 13
right now
• things are pretty good
• things could be better
• more ruby compatibility
• more libs, complete libs **
Sunday, November 10, 13
right now
• things are pretty good
• things could be better
• more ruby compatibility
• more libs, complete libs **
• documentation
Sunday, November 10, 13
right now
• things are pretty good
• things could be better
• more ruby compatibility
• more libs, complete libs **
• documentation
• we need your helP
Sunday, November 10, 13
things to do
Sunday, November 10, 13
things to do
• try it out,
Sunday, November 10, 13
things to do
• try it out, • opalrb.org/try
Sunday, November 10, 13
things to do
• try it out, • opalrb.org/try• http://fkchang.github.io/opal-irb/index-
embeddable.html
Sunday, November 10, 13
things to do
• try it out, • opalrb.org/try• http://fkchang.github.io/opal-irb/index-
embeddable.html • communicate - irc, google group
Sunday, November 10, 13
things to do
• try it out, • opalrb.org/try• http://fkchang.github.io/opal-irb/index-
embeddable.html • communicate - irc, google group• document
Sunday, November 10, 13
things to do
• try it out, • opalrb.org/try• http://fkchang.github.io/opal-irb/index-
embeddable.html • communicate - irc, google group• document• contribute, it’s just ruby
Sunday, November 10, 13
things to do
• try it out, • opalrb.org/try• http://fkchang.github.io/opal-irb/index-
embeddable.html • communicate - irc, google group• document• contribute, it’s just ruby• convert gems******, write new stuff, test, etc..
Sunday, November 10, 13
things to do
• try it out, • opalrb.org/try• http://fkchang.github.io/opal-irb/index-
embeddable.html • communicate - irc, google group• document• contribute, it’s just ruby• convert gems******, write new stuff, test, etc..• be a garbage collector, change the world
Sunday, November 10, 13
things to do
• try it out, • opalrb.org/try• http://fkchang.github.io/opal-irb/index-
embeddable.html • communicate - irc, google group• document• contribute, it’s just ruby• convert gems******, write new stuff, test, etc..• be a garbage collector, change the world
• have fun
Sunday, November 10, 13
things to do
• try it out, • opalrb.org/try• http://fkchang.github.io/opal-irb/index-
embeddable.html • communicate - irc, google group• document• contribute, it’s just ruby• convert gems******, write new stuff, test, etc..• be a garbage collector, change the world
• have fun• be happy
Sunday, November 10, 13
will you
• join the dark side?
Sunday, November 10, 13
or
• code with the force?
Sunday, November 10, 13
you choose
Sunday, November 10, 13
But for me
Sunday, November 10, 13
change the world, defeat the evil
Sunday, November 10, 13
resources
• opalrb.org
• github.com/opal
• irc opal
• google groups - not very active
• my blog funkworks.blogspot.com
• not a lot, but better than nothing
• more soon
Sunday, November 10, 13
thankful I am, for the garbage collectors
Sunday, November 10, 13
thankful I am, for the garbage collectors
• matz - ruby
Sunday, November 10, 13
thankful I am, for the garbage collectors
• matz - ruby
• dhh - rails
Sunday, November 10, 13
thankful I am, for the garbage collectors
• matz - ruby
• dhh - rails
• adam, meh, elia - opal
Sunday, November 10, 13
thankful I am, for the garbage collectors
• matz - ruby
• dhh - rails
• adam, meh, elia - opal
• ruby and rails communities
Sunday, November 10, 13
thankful I am, for the garbage collectors
• matz - ruby
• dhh - rails
• adam, meh, elia - opal
• ruby and rails communities
• George Lucas
Sunday, November 10, 13
thankful I am, for the garbage collectors
• matz - ruby
• dhh - rails
• adam, meh, elia - opal
• ruby and rails communities
• George Lucas
• you
Sunday, November 10, 13
hedgeye
• hiring like everyone else
• NYC Area, Stamford CT
Sunday, November 10, 13
may the force be with you
@fkchang2000
Sunday, November 10, 13