$30 off During Our Annual Pro Sale. View Details »

The Greener Gras

The Greener Gras

Should a Ruby developer migrate into Elixir territory? I gave this talk at https://rubyconference.by 2020.

Stefan Wintermeyer

July 19, 2020
Tweet

More Decks by Stefan Wintermeyer

Other Decks in Programming

Transcript

  1. THE GREENER GRASS
    Stefan Wintermeyer - @wintermeyer

    View Slide

  2. Ruby or Elixir?
    Spoiler alert:
    It’s not a technical decision.
    The 5 most active programming languages on GitHub:
    JavaScript, Python, Java, Rust, PHP

    View Slide

  3. http://www.website.com
    My First Commercial Webpage (1997)
    https://web.archive.org/web/19970413021718/http://www.swreisedienst.de/

    View Slide

  4. http://www.website.com
    My First Online Shop (1997)
    http://www.website.com
    https://web.archive.org/web/19970413021718/http://www.swreisedienst.de/
    https://web.archive.org/web/19970413021718/http://www.swreisedienst.de/

    View Slide

  5. My First Online Shop was written in Delphi (1997)
    http://www.website.com
    https://web.archive.org/web/19970413021718/http://www.swreisedienst.de/

    View Slide

  6. Programming Languages I’ve Used For Online Shops Since
    Language Server OS Development OS Framework
    Delphi Win 3.11 Win 3.11 -
    Perl Linux Linux -
    PHP Linux Linux and macOS -
    Ruby Linux macOS Ruby on Rails
    Elixir Linux macOS Phoenix Framework

    View Slide

  7. Biggest Pain = Paradigm Changes
    Language Programming paradigm
    Delphi Procedural
    Perl Procedural
    PHP Procedural
    Ruby Object-oriented
    Elixir Functional

    View Slide

  8. Ruby Elixir
    vs

    View Slide

  9. Ruby was published in
    1995 by Yukihiro
    Matsumoto for
    developer’s happiness.

    View Slide

  10. Elixir was created in
    2011 by José Valim to
    be a real concurrent
    language.

    View Slide

  11. Titlelize Code Example
    "ExMachina Hits 1.0 - More Flexible, More Useful and Support for Ecto 2.0"
    => "exmachina-hits-1-0-more-flexible-more-useful-and-support-for-ecto-2-0!
    Ruby Elixir
    https://thoughtbot.com/blog/elixir-for-rubyists

    View Slide

  12. Don’t let the easy to read
    Elixir syntax fool you into
    believing it’s painless to learn.
    Functional is a totally
    different ball game!

    View Slide

  13. Regular Switching
    Between Elixir And Ruby
    Back And Forth Results In
    Technical Jet Lag.

    View Slide

  14. We all know about Ruby.
    But what do people do with Elixir?

    View Slide

  15. Nerves Is An Astonishing Elixir Project
    Craft and deploy bulletproof embedded software in Elixir.
    • Raspberry Pi
    • BeagleBone
    • Generic x86_64
    https://www.nerves-project.org

    View Slide

  16. Nerves Example: FarmBot https://farm.bot

    View Slide

  17. vs
    But 99% Of The Discussion is Rails vs. Phoenix

    View Slide

  18. Fun fact: All players have a solid Ruby on Rails background.
    @josevalim @dhh @chris_mccord

    View Slide

  19. Ruby on Rails Doctrine
    "Optimize for programmer happiness"
    Me thinking: But I have been very unhappy with
    some gems and very happy with Phoenix.
    https://rubyonrails.org/doctrine/

    View Slide

  20. Phoenix Framework
    "Build rich, interactive web applications quickly, with
    less code and fewer moving parts"
    Me thinking: But I have done rich interactive web applications with Rails too.
    https://www.phoenixframework.org

    View Slide

  21. How does the 15 Minute Blog example hold on in 2020?
    DHH’s 2005 grandfather screencast: https://www.youtube.com/watch?v=Gzj723LkRJY

    View Slide

  22. Ruby on Rails
    @dhh

    View Slide

  23. $ rails new my_blog
    $ cd my_blog
    $ rails g scaffold post title body:text
    $ rails db:migrate
    $ rails server
    # Open http://0.0.0.0:3000/posts
    Fun fact:
    $ my_blog:> tree | wc -l
    19572

    View Slide

  24. View Slide

  25. View Slide

  26. Phoenix Framework
    @chris_mccord

    View Slide

  27. $ mix phx.new my_blog
    $ cd my_blog
    # configure database in config/dev.exs (no SQLite )
    $ mix ecto.create
    $ mix phx.gen.html Blog Post posts title body:text
    # add "resources "/posts", PostController" to router.ex
    $ mix ecto.migrate
    $ mix phx.server
    # Open http://0.0.0.0:4000/posts

    View Slide

  28. View Slide

  29. View Slide

  30. View Slide

  31. How Big Is The Community/Visibility?

    View Slide

  32. Twitter Followers
    428 K
    16 K
    @dhh
    @chris_mccord

    View Slide

  33. Stackoverflow
    Questions
    GitHub
    Contributors
    Ruby on Rails 319,073 4,252
    Phoenix
    Framework
    3,436 877

    View Slide

  34. Phoenix USPs
    Performance/Speed Scalability
    High-Availability Systems
    Hot Deployment

    View Slide

  35. "… Phoenix has delivered
    15x better performance
    than Rails …"
    https://medium.com/@elviovicosa/phoenix-vs-rails-benchmark-2019-f0e68336d557

    View Slide

  36. What should I use?

    View Slide

  37. Use Elixir/Phoenix if performance is paramount.
    Technically it is the best choice!

    View Slide

  38. Use Elixir/Phoenix if your
    team doesn’t have (much) Ruby knowledge yet.
    Technically it is the best choice!

    View Slide

  39. Use Ruby/Rails for all other cases.

    View Slide

  40. A bad programmer can write a slow program in Assembler.
    A good programmer can write a fast program in Visual Basic.
    Jon von Tetzchner told me that some 20 years ago.

    View Slide

  41. Do or do not.
    There is no try.
    Stefan Wintermeyer
    [email protected]
    @wintermeyer

    View Slide