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

What is Elixir good for?

What is Elixir good for?

The Elixir part of a meetup comparing Ruby and Elixir. [ https://www.meetup.com/Polyglot-Tech-London/events/233382618/ ]

Maciej Matyjas

September 20, 2016
Tweet

More Decks by Maciej Matyjas

Other Decks in Programming

Transcript

  1. What is Elixir good for? Maciej Matyjas | Director, Tech

    | Hotels.com @matyjas | snaps/ma-tyjas | linkedin/matyjas Feedback please! https://goo.gl/ifyAcF 2016-Sept-20
  2. Confidential - do not distribute - Looks like Ruby -

    Smells like Clojure - Runs like Erlang - Memes Hello Elixir
  3. Confidential - do not distribute Which is Ruby? Elixir? def

    hello do "result" end Elixir def hello "result" end Ruby
  4. Confidential - do not distribute Which is Ruby? Elixir? defmodule

    Example end Elixir module Example end Ruby
  5. Confidential - do not distribute Which is Ruby? Elixir? #

    :one 5 / 2 == 2.5 IO.puts "Hello World" Elixir # :one 5 / 2 == 2 puts "Hello World" Ruby
  6. Confidential - do not distribute defprotocol Empty do def empty?(collection)

    end defimpl Empty, for: List do def empty?([]), do: true def empty?(_), do: false end Protocols: From Clojure, with Polymorphism
  7. Confidential - do not distribute defimpl Empty, for: Map do

    def empty?(map) do case Map.keys(map) do [] -> true _ -> false end end end Protocols: From Clojure, with Polymorphism
  8. Confidential - do not distribute end Empty.empty?([1, 2, 3]) #

    => false Empty.empty?([]) # => true Protocols: From Clojure, with Polymorphism
  9. Confidential - do not distribute Empty.empty?(%{foo: "bar"}) # => false

    Empty.empty?(%{}) # => true Protocols: From Clojure, with Polymorphism
  10. Confidential - do not distribute - Super crazy fast -

    Concurrency - Fault tolerance - Distributed - OTP provides architectural primitives - Queues - Caches - Persistence - GenServer Erlang & OTP for the Win!
  11. Confidential - do not distribute - 2 million connections on

    a single commodity server - 900 million users and 50 developers (1 year ago) - Queues plus GenServers are perfect for messaging WhatsApp
  12. Confidential - do not distribute - Routing - Logging -

    Supervisors for fault tolerance Heroku
  13. Confidential - do not distribute - Super crazy fast -

    OTP goodness Phoenix is not Rails, but what is it?
  14. Time for questions? Maciej Matyjas | Director, Tech | Hotels.com

    @matyjas | snaps/ma-tyjas | linkedin/matyjas Feedback please! https://goo.gl/ifyAcF 2016-Sept-20
  15. Confidential - do not distribute - http://www.bigdatalittlegeek.com/blog/2014/7/10/ruby-vs-elixir-an-unfair-fight-and-elixir-wins - https://elixir-examples.github.io/examples/elixir-and-ruby-comparison -

    http://hilite.me/ - https://medium.com/@qertoip/elixir-obsoletes-ruby-erlang-and-clojure-in-one-go- 605329b7b9b4#.hpu4rs7gx - https://en.wikipedia.org/wiki/Polymorphism_(computer_science) - http://clojure.org/reference/protocols - https://blog.drewolson.org/extensible-design-with-protocols/ References
  16. Confidential - do not distribute - http://www.erlang-factory.com/sfbay2016 - https://www.wired.com/2015/09/whatsapp-serves-900-million-users-50-engineers/ -

    https://blog.whatsapp.com/196/1-million-is-so-2011 - https://robots.thoughtbot.com/elixir-for-rubyists - https://github.com/mroth/phoenix-showdown/blob/master/RESULTS_v2.md References (continued)