Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Opal - Ruby Style!! Ruby in the browser

6,719 views

Published on

Slides for the talk on opalrb I gave at OCRuby last night

Published in: Technology
  • Be the first to comment

Opal - Ruby Style!! Ruby in the browser

  1. 1. OPAL - RUBY STYLERUBY IN THE BROWSER Forrest Chang, OCRuby
  2. 2. TRENDS
  3. 3. NODE.JS
  4. 4. NOV 2011MOST POPULAR REPO ON GITHUB
  5. 5. JAVASCRIPT REVOLUTION
  6. 6. JS EVERYWHERE
  7. 7. IDEA: TAKE THE FRONTENDLANGUAGE PUT IT THE BACK END
  8. 8. GOOD IDEA?
  9. 9. LANGUAGES THAT COMPILE TO JAVASCRIPT
  10. 10. JUST A FEW..
  11. 11. I GET THE IDEA PEOPLEMIGHT PREFER SOMETHING OTHER THAN JAVASCRIPT
  12. 12. IDEA: TAKE THE BACKENDLANGUAGE, PUT IT ON THE FRONT END
  13. 13. APPARENTLY A POPULAR IDEA
  14. 14. Coffeescript
  15. 15. WHY
  16. 16. Better syntaxLess verbose, clearer, more intentionSome nice features, list comprehensions, implicitreturn, etc.Happier programmers *
  17. 17. Y U NO COFFEESCRIPT?
  18. 18. NOTHING WRONG WITH IT
  19. 19. BUT I LIKE RUBY BETTER
  20. 20. AND ALREADY WORK RUBY ON THE BACKEND
  21. 21. BUT IF YOU’RE GOING TOCHANGE THE SYNTAX, WHY NOT ALL THE WAY?
  22. 22. HASN’T IT BEEN TRIED BEFORE?
  23. 23. active
  24. 24. activeactive
  25. 25. active Less ruby likeactive
  26. 26. WHAT IS OPAL
  27. 27. RUNTIME?
  28. 28. USED TO BOTHER ME, MIGHT BOTHER ME AGAIN LATER
  29. 29. JAVASCRIPT IS NOW THE “C OF THE WEB”
  30. 30. DO PEOPLE CARE THATRUBY/LISP/PYTHON DOESN’T LOOK/ACT LIKE C
  31. 31. AS LONG AS IT’S DONE WELL
  32. 32. EMBRACE THEABSTRACTION!
  33. 33. HTTPS://GITHUB.COM/OPAL opalscript Javascript + Ruby = OpalScript (Sssh, Its a secret and not ready yet). • opal-spec Last updated 14 hours ago Spec Library for opal Last updated 23 days ago• opal Ruby runtime and library on top of Javascript • opal-rails Last updated 14 hours ago Rails bindings for Opal JS engine Last updated a month ago• opal-jquery Give opal access to jquery Last updated 15 hours ago • opal-erb• opal-todos ERB parser and runtime for opal Last updated a month ago todomvc based opal example Last updated 3 days ago • vienna• opal-node Client-side MVC framework for Opal Last updated a month ago Coffescript was so cool… Last updated 3 days ago• opal.github.com Opal Website Last updated 7 days ago
  34. 34. I HAD A SIMILAR IDEA
  35. 35. CHAI-SCRIPTHot drink motif. What drink is reddish?Ruby equivalent of CoffeescriptSyntactic sugar, but ruby flavoreventd subset of ruby w/idea of eventd gems for frontand backendEase ‘em into ruby
  36. 36. OPALSCRIPTLikely the same idea1st public commits just released on 10/24/2012 (i.e.yesterday)I’ll be keeping a key eye on this, not certain which I’llprefer
  37. 37. MY DRIVER
  38. 38. MATZ PRINCIPLE
  39. 39. MAKE THE PROGRAMMER HAPPY
  40. 40. I.E. ME
  41. 41. I’M ENJOYING IT THUS FAR
  42. 42. A NEAT IDEA - TRY OPAL
  43. 43. An example: bit.ly/WFHLyh
  44. 44. CODE
  45. 45. modules to share functionality
  46. 46. modules to share functionalitywrapping js via x string
  47. 47. modules to share functionality wrapping js via x stringEasy classes
  48. 48. modules to share functionality wrapping js via x stringEasy classes include module
  49. 49. modules to share functionality wrapping js via x stringEasy classes include module easy attributes
  50. 50. modules to share functionality wrapping js via x stringEasy classes include module easy attributes calling my js wrapper
  51. 51. modules to share functionality wrapping js via x stringEasy classes include module easy attributes calling my js wrapper Inheritance, baby
  52. 52. modules to share functionality wrapping js via x string Easy classes include module easy attributes calling my js wrapper Inheritance, babysuper, baby
  53. 53. modules to share functionality wrapping js via x string Easy classes include module easy attributes calling my js wrapper Inheritance, babysuper, baby reusing JsUtils again...
  54. 54. COMPILED JS PRETTYSTRAIGHT FORWARD
  55. 55. BUT VERBOSE
  56. 56. Opal runtime
  57. 57. Opal runtimematching line of code
  58. 58. Opal runtime matching line of codeJsUtils module
  59. 59. Opal runtime matching line of codeJsUtils module js alert wrapped
  60. 60. Opal runtime matching line of codeJsUtils module js alert wrappedDude class
  61. 61. Gal class
  62. 62. Gal class super
  63. 63. Gal class super Bystander class
  64. 64. Gal class super Bystander class Instance invocations
  65. 65. WHAT’S TO LIKE?RubyRakeRspecnicer APIsRuby on the backend, Ruby on the frontend
  66. 66. RUBY EVERYWHERE!
  67. 67. Desktop/Server: MRI, JRuby, Iron Ruby, RubiniusFaster Rubylike subset for JVM (Android and otherpossibilities) MirahEmbedded: mrubyIOS: RubyMotionBrowser/Node: opal
  68. 68. YOU KNOW WHAT I MEAN?
  69. 69. CODE ALONG
  70. 70. opalopal-railsopal-jqueryopal filter in hamlfollow the gist https://gist.github.com/3956417

×