Let's create stateful systems, by Elixir

Let's create stateful systems, by Elixir

4b071f90c5d9c0a58e2d9076460b7be4?s=128

さっちゃん

August 24, 2019
Tweet

Transcript

  1. 4.

    2

  2. 5.

    Two

  3. 6.

  4. 7.

  5. 9.

    I & you hot & ice stand up & lie

    down inside & outside
  6. 12.

    Dialogue is stateful. Alice : X. Bob : Y. Alice

    : X. Bob : Z. Most of the system is stateful.
  7. 13.
  8. 14.

    Elixir is a functional programming language. Functional programming is stateless.

    All data of Elixir is immutable. [x, 3, x] = Enum.map([1,2,1], &(&1 + 1)) assert 2 == x // Many lines that don't reassign to `x`. assert 2 == x
  9. 16.

    Process has state. agent = Agent.start_link(fn -> 29 end) 29

    = Agent.get(agent, &(&1)) Agent.update(agent, &(&1 + 13)) 42 = Agent.get(agent, &(&1))
  10. 17.

    State should be updated in a transaction. State shold interact

    & isolate each other. Accessing to state should be scaled in-out. Server with state should be updated gracefully. Elixir has all of these!
  11. 18.

    State should be updated in a transaction. (No shared state)

    State shold interact & isolate each other. (Application, Supervisor) Accessing to state should be scaled in-out. (GenStage, Task, Register, Erlang cluster) Server with state should be updated gracefully. (Hot code swap)
  12. 20.

    How we can start Elixir? Let's create some applications. *

    Web application with Phoenix. * Slack bot.
  13. 21.
  14. 22.

    React is available (✿ >ヮ ╹ )-♡ Let's create a

    realtime interaction ∩ (> ◡ <*)∩ ♡ https://speakerdeck.com/ne_sachirou/phoenix-livereact
  15. 24.

    Installing Elixir. asdf https://asdf-vm.com/ asdf plugin-add erlang asdf install erlang

    22.0.7 asdf plugin-add elixir asdf install elixir 1.9.1
  16. 26.
  17. 27.

    Docker image (You need Docker :-) Fix major ver.s both

    Erlang & Elixir. docker run -it --rm nesachirou/elixir:1.9_erl22
  18. 28.

    Textbook & document. Official guide : https://elixir-lang.org/ Official document :

    https://hexdocs.pm/elixir/Kernel.html Online textbook : https://elixirschool.com/ja/ Textbook : https://tatsu-zine.com/books/programming-elixir-ja