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

Elug SP 2016 -- From Ruby to Elixir: What now?

Elug SP 2016 -- From Ruby to Elixir: What now?

Renan Ranelli

January 30, 2016
Tweet

More Decks by Renan Ranelli

Other Decks in Programming

Transcript

  1. AGENDA • Why are people talk so much about functional

    programming (FP)? • A little bit of context on what we are doing with Elixir @ Xerpa • Elixir & Ruby – What's the difference? • The main problems & difficulties we encountered so far • Final points & discussion
  2. WHAT IS HAPPENING IN THE HARDWARE INDUSTRY? • You should

    google “no more free lunch” and read the first article. Seriously. • Since I'm already here, I'll give you a primer: – CPU clock is not getting exponentially faster – Transistor number is still growing rapidly – No performance gain for single threaded apps – Concurrency is the next major revolution in how we write software
  3. > Concurrency is the next major revolution in how we

    write software > Applications will increasingly need to be concurrent if they want to fully exploit continuing exponential CPU throughput gains > Efficiency and performance optimization will get more, not less, important
  4. In 2005: – Java 5 was hot news. – Windows

    XP. Vista only in 2007. – No AWS, Twitter, Netflix. – Ruby on Rails launched in December 13th. – Youtube was just founded. – We never have heard of Justin Bieber – I was playing Gunbound & Tibia. No money for WoW.
  5. ELIXIR @ XERPA • Our Stack so far: – Phoenix

    – Postgresql (?!) – Clojurescript (Re-frame/react) – ElasticSearch (?!) – Ruby + Selenium for acceptance tests – Shell + Ansible + AWS for all things
  6. ELIXIR >> RUBY • Where Elixir excels over Ruby ?

    – IMMUTABILITY – THERE IS A COMPILER
  7. ELIXIR >> RUBY • Where Elixir excels over Ruby ?

    – IMMUTABILITY – THERE IS A COMPILER – IMMUTABILITY
  8. ELIXIR >> RUBY • Where Elixir excels over Ruby ?

    – IMMUTABILITY – THERE IS A COMPILER – IMMUTABILITY
  9. ELIXIR >> RUBY • Where Elixir excels over Ruby ?

    – IMMUTABILITY – THERE IS A COMPILER – IMMUTABILITY – Docs & tooling receive much more love (!?)
  10. ELIXIR >> RUBY • Where Elixir excels over Ruby ?

    – IMMUTABILITY – THERE IS A COMPILER – IMMUTABILITY – Docs & tooling receive much more love (!?) – MACROS (!? ruby doesn't need them!)
  11. ELIXIR >> RUBY • Where Elixir excels over Ruby ?

    – IMMUTABILITY – THERE IS A COMPILER – IMMUTABILITY – Docs & tooling receive much more love (!?) – MACROS (!? ruby doesn't need them!) – OTP
  12. ELIXIR >> RUBY • Where Elixir excels over Ruby ?

    – IMMUTABILITY – THERE IS A COMPILER – IMMUTABILITY – Docs & tooling receive much more love (!?) – MACROS (!? ruby doesn't need them!) – OTP – Iex >> Irb (!?)
  13. PHOENIX >> RAILS • Where Phoenix excels over Rails ?

    – SUPER DUPPER FAST (!?) – Much easier to setup for high concurrency
  14. PHOENIX >> RAILS • Where Phoenix excels over Rails ?

    – SUPER DUPPER FAST (!?) – Much easier to setup for high concurrency – Much less magic. Mostly everything is based on simple function calls.
  15. PHOENIX >> RAILS • Where Phoenix excels over Rails ?

    – SUPER DUPPER FAST (!?) – Much easier to setup for high concurrency – Much less magic. Mostly everything is based on simple function calls. – Views vs Templates.
  16. PROBLEMS WE ENCOUNTERED SO FAR • The ecosystem is still

    very small (and buggy). – No options for monitoring apps (like new relic, appsignal, honeybadger). – No Sidekiq. – ExMachina (elixir's factory girl) is so broken. – No Monads.
  17. PROBLEMS WE ENCOUNTERED SO FAR • The ecosystem is still

    very small (and buggy). – No usable client for elastic search (?!) – No usable (at the time?) library for exposing jsonapi (?!) – No usable (at the time) library to handle acls (?!) – No usable bindings for ImageMagick (?!) – Releases are so damn hard and un-12factor – Hot code reloads are much much harder than people say – Almost no problems with core libs like Ecto, Plug & Phoenix though.
  18. RUBY STILL HAS THE EDGE IN THESE AREAS: – Ruby

    can tap into the JVM with Jruby. – Ruby's stdlib has waaaaaaay more stuff out of the box – A *big* and mature ecosystem – A lot of developers willing to work with it – Although Elixir can tap into erlang-land's libraries and tools, they are much harder to use (less googlability, bad/incomplete docs)
  19. On Elixir • Elixir is *very promissing*, and has learned

    a lot from other communities. (e.g. Queryable is an idea from .net's Linq) • You can see that it evolves and taps into the learning experiences of other languages & communities. It still lacks a mature ecosystem but it is gaining traction fast. • If you truly aim to invest yourself in it, you must be ready to get your hands dirt and write a lot of infrastructure you can take for granted in Ruby-land. Do not underestimate the complexity of managing library code + tests + docs + versioning + bug tracking.
  20. On Ruby • Although Ruby is no longer the crème-de-la-crème,

    it is not stagnant. • Many nice ideas on how to add better concurrency to Ruby. Ruby 3 promises to be 3x faster than Ruby 2, while keeping maximum backwards-compatibility.