4 ms·
My advice: 1. read the doc. This is entirely covered, see below 2. Avoid using process which stand as a low level API. 3. Only use one of the Processes abstr
by melicerte 6y ago
My advice:
1. read the doc. This is entirely covered, see below
2. Avoid using process which stand as a low level API.
3. Only use one of the Processes abstraction if you need a mutable state
4. Agent is the base abstraction on top of the process
5. use GenServer if you need more than a simple mutable state storage
6. more importantly: do not forget code organization is done by modules and functions, processes are not necessary for that purpose.
[1] Processes: https://elixir-lang.org/getting-started/processes.html https://elixir-lang.org/getting-started/processes.html
[2] Agent: https://elixir-lang.org/getting-started/mix-otp/agent.html https://elixir-lang.org/getting-started/mix-otp/agent.html
[3] GenServer: https://elixir-lang.org/getting-started/mix-otp/genserver.html https://elixir-lang.org/getting-started/mix-otp/genserver.ht...
[4] distinction between Agent, Task and GenServer: https://elixir-lang.org/getting-started/mix-otp/agent.html#the-trouble-with-state https://elixir-lang.org/getting-started/mix-otp/agent.html#t...
[5] Superviser: https://elixir-lang.org/getting-started/mix-otp/supervisor-and-application.html https://elixir-lang.org/getting-started/mix-otp/supervisor-a...