Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Volt: Ruby Web Development Recharged

Volt: Ruby Web Development Recharged

Slide deck from my talk at the BulgariaWebSummit 2015.

Bozhidar Batsov

April 18, 2015
Tweet

More Decks by Bozhidar Batsov

Other Decks in Programming

Transcript

  1. Volt: Ruby Web
    Development Recharged
    by Bozhidar Batsov

    View Slide

  2. @bbatsov

    View Slide

  3. Joan

    View Slide

  4. View Slide

  5. Few important things you
    need to know about me

    View Slide

  6. View Slide

  7. View Slide

  8. I’m an Emacs fanatic

    View Slide

  9. I still have nightmares about
    PHP4

    View Slide

  10. I love Ruby

    View Slide

  11. I tolerate Rails

    View Slide

  12. I don’t like JavaScript

    View Slide

  13. View Slide

  14. Why am I here?

    View Slide

  15. Welcome to Rubylandia!

    View Slide

  16. Ruby (2005)

    View Slide

  17. View Slide

  18. View Slide

  19. View Slide

  20. Ruby (2006)

    View Slide

  21. OMG, Rails is amazing!

    View Slide

  22. Ruby (2008)

    View Slide

  23. OMG, Rails is amazing &
    useful!

    View Slide

  24. Ruby (today)

    View Slide

  25. Rails is somewhat boring…

    View Slide

  26. Rails is the new JEE!

    View Slide

  27. Aren’t all the cool devs
    doing Clojure now?

    View Slide

  28. Hell,
    yeah!!!

    View Slide

  29. Rails innovation (2005-2008)
    Convention over configuration
    Interactive development
    Scaffolding
    ActiveRecord
    REST

    View Slide

  30. Rails innovation (today)
    Turbolinks
    foreign keys
    background jobs

    View Slide

  31. View Slide

  32. View Slide

  33. 10%
    90%
    Rails Other

    View Slide

  34. 4%
    96%
    Web Development Other

    View Slide

  35. Fuck this
    shit!!!

    View Slide

  36. Rails, Rails, Rails

    View Slide

  37. Development Complexity

    View Slide

  38. 0
    25
    50
    75
    100
    1999 2000 2001 2002 2003 2004 2005 2006 2007 2009 2011 2015

    View Slide

  39. Web development (2005)
    Model
    View
    Controller
    Routing
    Server Client

    View Slide

  40. Web development (2006)
    Model
    View
    Controller
    Routing
    Server Client
    AJAX
    RandomJS

    View Slide

  41. Web development (2010)
    Model
    View
    Controller
    Routing
    Server Client
    AJAX
    REST
    Assets
    RandomJS

    View Slide

  42. Web development (2013)
    Model
    View
    Controller
    Routing
    Server Client
    AJAX
    REST
    Model
    View
    Controller
    Routing
    Assets
    Assets

    View Slide

  43. View Slide

  44. What’s the solution?

    View Slide

  45. VBScript!

    View Slide

  46. Isomorphic Development

    View Slide

  47. Isomorphic?

    View Slide

  48. Isomorphic
    being of identical or similar form, shape, or structure

    View Slide

  49. Same code runs on the
    client & the server

    View Slide

  50. Web development (2015)
    Model
    View
    Controller
    Routing
    Server Client
    AJAX
    REST
    Model
    View
    Controller
    Routing
    Assets
    Assets
    Shared
    Auto Sync

    View Slide

  51. View Slide

  52. Meet Volt

    View Slide

  53. Volt is isomorphic

    View Slide

  54. Models, views, controllers & routing are
    shared between the client and the
    server

    View Slide

  55. WOW!!!

    View Slide

  56. Meteor.js

    View Slide

  57. Ruby on the server-side,
    Ruby on the client-side

    View Slide

  58. Ruby on the server-
    side,
    Ruby on the client-
    side

    View Slide

  59. Ruby on the server-side

    View Slide

  60. Ruby on the
    client-side

    View Slide

  61. Fuck this
    shit!!!

    View Slide

  62. Ruby > JavaScript

    View Slide

  63. View Slide

  64. View Slide

  65. Ruby’s advantages
    Does’t have this
    Sane nil semantics
    No need for a book called “Ruby: The Good Parts”
    Standard library
    Do you really need more?

    View Slide

  66. Fuck this
    shit!!!

    View Slide

  67. Opal.rb
    http://opalrb.org/

    View Slide

  68. Does this shit work?

    View Slide

  69. Yes!

    View Slide

  70. def hello(name)
    puts "Hello, #{name.capitalize}!"
    end
    hello("bruce")

    View Slide

  71. /* Generated by Opal 0.7.0 */
    (function(Opal) {
    Opal.dynamic_require_severity = "error";
    var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice;
    Opal.add_stubs(['$puts', '$capitalize', '$hello']);
    Opal.Object.$$proto.$hello = function(name) {
    var self = this;
    return self.$puts("Hello, " + (name.$capitalize()) + "!");
    };
    return self.$hello("bruce");
    })(Opal);

    View Slide

  72. Is this shit any good?

    View Slide

  73. Debatable

    View Slide

  74. Opal features
    Source maps
    ruby-spec compatibility
    Small footprint
    Little performance overhead

    View Slide

  75. Ruby compatibility
    Mostly compatible with Ruby 2.0
    Implements most of the Ruby stdlib
    Has immutable strings (unlike Ruby)

    View Slide

  76. Fuck this
    shit!!!

    View Slide

  77. Volt Architecture

    View Slide

  78. MVC
    Controller View
    Model

    View Slide

  79. MVVM
    Controller/
    ViewModel
    View
    Model

    View Slide

  80. Volt is reactive

    View Slide

  81. Web Sockets FTW

    View Slide

  82. <:Body>
    Todo List


    Todo
    value="{{ page._new_todo }}" />


    View Slide

  83. def add_todo
    page._todos << { name: page._new_todo }
    page._new_todo = ''
    end

    View Slide

  84. <:Body>
    Todo List

    {{ page._todos.each do |todo| }}

    {{ todo._name }}

    {{ end }}

    View Slide

  85. View Slide

  86. Demo

    View Slide

  87. Interesting bits
    Components
    User management is built-in
    Tasks

    View Slide

  88. Volt’s not perfect
    Opal isn’t quite there yet
    MongoDB is the only supported datastore
    Many features are work in progress
    The documentation is kind of lacking

    View Slide

  89. Contribute to Volt!

    View Slide

  90. https://github.com/voltrb

    View Slide

  91. 0
    25
    50
    75
    100
    1998 1999 2000 2001 2002 2003 2004 2005 2006 2009 2011 2015

    View Slide

  92. 0
    25
    50
    75
    100
    1998 1999 2000 2001 2002 2003 2004 2005 2006 2009 2011 2015 2016

    View Slide

  93. Hell,
    yeah!!!

    View Slide

  94. Getting Started with Volt
    Official docs (http://voltframework.com/docs)
    gitter
    office hours
    video tutorials

    View Slide

  95. Felina

    View Slide

  96. @bbatsov
    http://batsov.com
    http://emacsredux.com

    View Slide

  97. View Slide