Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Let's create stateful systems, by Elixir
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
さっちゃん
August 24, 2019
Programming
1.1k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Let's create stateful systems, by Elixir
さっちゃん
August 24, 2019
More Decks by さっちゃん
See All by さっちゃん
敎へない敎師と、考へる機械
ne_sachirou
0
18
火星曆
ne_sachirou
0
48
みんなのオブザーバビリティプラットフォームを作ってるんだがパフォーマンスがやばい #mackerelio #srenext
ne_sachirou
0
1.7k
作ってよかったgraceful shutdownライブラリ #kyotogo
ne_sachirou
0
1.5k
path 依存型って何?
ne_sachirou
0
860
野生の onbording と onbording 設計 #kyototechtalk
ne_sachirou
0
750
メトリックはいかにして見え續ける樣になったか #devio2022
ne_sachirou
0
140
名實一致
ne_sachirou
0
760
まかれるあなとみあ ―Mackerel のしくみを理解する 30 分― @ Hatena Engineer Seminar #16
ne_sachirou
0
3.3k
Other Decks in Programming
See All in Programming
ルールを書いて終わらせないハーネスエンジニアリング
yug1224
4
1.9k
Android CLI
fornewid
0
210
OpenSpecのproposalにbrainstormingを持たせてみた
tigertora7571
1
210
Claude CodeとAgentCore Gatewayを繋ぐ際の認証認可 / Authentication and authorization when connecting Claude Code with AgentCore Gateway
har1101
1
260
yield再入門 #phpcon
o0h
PRO
0
980
PostgreSQL 18で考えるUUID主キー
kazuhiro1982
0
460
GDG Korea Android: 2026 I/O Extended ~ What's new in Android development tools
pluu
0
220
Laravelで学ぶ Webアプリケーションチューニング入門/web_application_tuning_101
hanhan1978
4
1.7k
生成AI導入の「期待外れ」を乗り越える ー 開発フロー改革が目指す、真の組織変革
starfish719
0
4k
属人化した知識を、 AIが辿れる地図にする
pkshadeck
PRO
1
150
AI時代に設計が 最大の生産性レバーになる 意図駆動開発とデータを消さない設計|Don't Delete Your Data or Your Intent — Design as the Deepest Lever in the AI Era
tomohisa
1
730
AI Engineeringは、AIプロダクトだけのものか? 〜AIがソフトウェアを作る時代の新しい当たり前〜 / No AI in your product. AI Engineering in your development.
rkaga
4
380
Featured
See All Featured
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
The browser strikes back
jonoalderson
0
1.5k
Thoughts on Productivity
jonyablonski
76
5.3k
HDC tutorial
michielstock
2
790
How to make the Groovebox
asonas
2
2.3k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4.2k
The untapped power of vector embeddings
frankvandijk
2
1.8k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.6k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.8k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
470
Writing Fast Ruby
sferik
630
63k
Documentation Writing (for coders)
carmenintech
77
5.4k
Transcript
Let's create stateful systems, by Elixir
. 。oO( さっちゃんですよヾ( 〃l _ l) ノ゙☆)
I'll show you a number.
2
Two
Ⅱ
⼆
2 is a number of collison & collaboration.
I & you hot & ice stand up & lie
down inside & outside
stateless & stateful
Function is stateless. f : x -> y e.g. Web
server
Dialogue is stateful. Alice : X. Bob : Y. Alice
: X. Bob : Z. Most of the system is stateful.
Elixir
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
Elixir has processes. 29 = Task.async(fn -> 29 end) |>
Task.await
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))
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!
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)
We can create stateful system easy, by constructing stateless parts.
How we can start Elixir? Let's create some applications. *
Web application with Phoenix. * Slack bot.
Phoenix is a Web application framework that familiar with WebSocket.
https://hexdocs.pm/phoenix/overview.html
React is available (✿ >ヮ ╹ )-♡ Let's create a
realtime interaction ∩ (> ◡ <*)∩ ♡ https://speakerdeck.com/ne_sachirou/phoenix-livereact
Create a Slack bot. https://github.com/BlakeWilliams/Elixir-Slack (Easy, so no topic.)
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
Text editor? VSCode with mjmcloug.vscode-elixir works.
Format & lint. InnerCotton https://github.com/ne-sachirou/inner_cotton is a set of standard
development tools. mix cotton.init mix cotton.lint --fix
Docker image (You need Docker :-) Fix major ver.s both
Erlang & Elixir. docker run -it --rm nesachirou/elixir:1.9_erl22
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
https://speakerdeck.com/ne_sachirou/elixirwan-quan-nili-jie-sita
Advanced resources
Erlang in Anger https://ymotongpoo.github.io/erlang-in-anger/text-ja.pdf You want to read this… before
production.
https://speakerdeck.com/ne_sachirou/sutetohurudeda-gui-mo- akusesufalsearusoft-realtimenagemusabawoeasynitukuru
https://speakerdeck.com/ne_sachirou/elixir-on-containers
https://speakerdeck.com/ne_sachirou/phoenix-at-scale
https://speakerdeck.com/ne_sachirou/ddd-data-driven-development