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

Elixir. There and Back Again

Elixir. There and Back Again

Nikolay Sverchkov

March 06, 2018
Tweet

More Decks by Nikolay Sverchkov

Other Decks in Programming

Transcript

  1. EVIL MARTIANS

    View full-size slide

  2. EVIL MARTIANS

    View full-size slide

  3. Nikolay Sverchkov
    @ssnickolay

    View full-size slide

  4. Battle of facts

    View full-size slide

  5. Dependencies

    View full-size slide

  6. ???
    “Welcome email”
    ???

    View full-size slide

  7. Sidekiq (Redis)
    “Welcome email”
    ???

    View full-size slide

  8. GenServer
    defmodule EmailSender do
    use GenServer
    def handle_cast({:send, email}, state) do
    # send email
    {:noreply, state}
    end
    end
    # Start the server
    {:ok, pid} = GenServer.start_link(EmailSender, [])
    # This is the client
    GenServer.cast(pid, {:send, “[email protected]"})
    #=> :ok

    View full-size slide

  9. Sidekiq (Redis)
    “Welcome email”
    [OTP] GenServer

    View full-size slide

  10. Sidekiq (Redis)
    ???
    “We love cashcache”
    [OTP] GenServer
    ???

    View full-size slide

  11. Sidekiq (Redis)
    Memcached
    “We love cashcache”
    [OTP] GenServer
    ???

    View full-size slide

  12. Memcached vs ETS

    View full-size slide

  13. Sidekiq (Redis)
    Memcached
    “We love cashcache”
    [OTP] GenServer
    [OTP] ETS

    View full-size slide

  14. Sidekiq (Redis)
    Memcached
    ???
    “Where is my long polling?”
    [OTP] GenServer
    [OTP] ETS
    ???

    View full-size slide

  15. Sidekiq (Redis)
    Memcached
    AnyCable
    “Where is my long polling?”
    [OTP] GenServer
    [OTP] ETS
    ???

    View full-size slide

  16. Sidekiq (Redis)
    Memcached
    AnyCable
    “Where is my long polling?”
    [OTP] GenServer
    [OTP] ETS
    Phoenix Channels

    View full-size slide

  17. Sidekiq (Redis)
    Memcached
    AnyCable
    ???
    Message broker
    [OTP] GenServer
    [OTP] ETS
    Phoenix Channels
    ???

    View full-size slide

  18. Sidekiq (Redis)
    Memcached
    AnyCable
    RabbitMQ
    Message broker
    [OTP] GenServer
    [OTP] ETS
    Phoenix Channels
    RabbitMQ

    View full-size slide

  19. Wait, it's like…

    View full-size slide

  20. Erlang -> Java
    BEAM -> JVM
    Elixir -> ???

    View full-size slide

  21. Spring + Bootsnap
    Speed
    By Design

    View full-size slide

  22. Spring + Bootsnap
    ???
    Architecture [DDD]
    By Design
    ???

    View full-size slide

  23. Spring + Bootsnap
    Trailblazer\Dry(Hanami?)
    Architecture [DDD]
    By Design
    By Design

    View full-size slide

  24. Spring + Bootsnap
    Trailblazer\Dry(Hanami?)
    ???
    Umbrella
    By Design
    By Design
    ???

    View full-size slide

  25. Spring + Bootsnap
    Trailblazer\Dry(Hanami?)
    Hanami?
    Umbrella
    By Design
    By Design
    By Design

    View full-size slide

  26. Flawless Victory?

    View full-size slide

  27. I have to rewrite everything
    with Elixir

    View full-size slide

  28. Spring + Bootsnap
    Trailblazer\Dry(Hanami?)
    Hanami?
    ???
    Debugging
    By Design
    By Design
    Umbrella
    ???

    View full-size slide

  29. Spring + Bootsnap
    Trailblazer\Dry(Hanami?)
    Hanami?
    Pry
    Debugging
    By Design
    By Design
    Umbrella
    IEx.pry

    View full-size slide

  30. Spring + Bootsnap
    Trailblazer\Dry(Hanami?)
    Hanami?
    Pry
    ???
    Deploy
    By Design
    By Design
    Umbrella
    IEx.pry
    ???

    View full-size slide

  31. Spring + Bootsnap
    Trailblazer\Dry(Hanami?)
    Hanami?
    Pry
    Docker\Capistrano
    Deploy
    By Design
    By Design
    Umbrella
    IEx.pry
    Mix\Distillery

    View full-size slide

  32. Spring + Bootsnap
    Trailblazer\Dry(Hanami?)
    Hanami?
    Pry
    Docker\Capistrano
    ???
    Tests tooling
    By Design
    By Design
    Umbrella
    IEx.pry
    Mix\Distillery
    ???

    View full-size slide

  33. Spring + Bootsnap
    Trailblazer\Dry(Hanami?)
    Hanami?
    Pry
    Docker\Capistrano
    Rspec\Capybara
    Tests tooling
    By Design
    By Design
    Umbrella
    IEx.pry
    Mix\Distillery
    Espec\Hound

    View full-size slide

  34. Spring + Bootsnap
    Trailblazer\Dry(Hanami?)
    Hanami?
    ActiveRecord (Rom?)
    Docker\Capistrano
    Rspec\Capybara
    Upload Image
    By Design
    By Design
    Umbrella
    Ecto
    Mix\Distillery
    Espec\Hound

    View full-size slide

  35. Spring + Bootsnap
    Trailblazer\Dry(Hanami?)
    Hanami?
    ActiveRecord (Rom?)
    Docker\Capistrano
    Rspec\Capybara
    Send Email with attachment
    By Design
    By Design
    Umbrella
    Ecto
    Mix\Distillery
    Espec\Hound

    View full-size slide

  36. Spring + Bootsnap
    Trailblazer\Dry(Hanami?)
    Hanami?
    ActiveRecord (Rom?)
    Docker\Capistrano
    Rspec\Capybara
    Authorization
    By Design
    By Design
    Umbrella
    Ecto
    Mix\Distillery
    Espec\Hound

    View full-size slide

  37. Spring + Bootsnap
    Trailblazer\Dry(Hanami?)
    Hanami?
    ActiveRecord (Rom?)
    Docker\Capistrano
    Rspec\Capybara
    Update deps
    By Design
    By Design
    Umbrella
    Ecto
    Mix\Distillery
    Espec\Hound

    View full-size slide

  38. Good for:
    Monolith
    Microservice
    Terrible for:
    Concurrency
    Key points
    Good for:
    Microservice
    Concurrency
    Terrible for:
    CMS
    Admin panel

    View full-size slide

  39. Why exactly Elixir?

    View full-size slide

  40. Why exactly Elixir?
    • Fast learning
    • A lot of job offers
    • http://erlangjobs.ru/
    • High salary (Ruby < Elixir < Go)
    https://t.me/proelixir
    https://wunsh.ru/

    View full-size slide