In the previous article, we have learned about MVC and covered a little bit more how to work with Controllers and Views.
One piece is still missing. The models. Let’s talk about them now.
Last time we have covered the very basics of Phoenix framework.
We have managed to install a development environment and create the new project.
Today we will proceed and build the basic application layout.
I was covering Elixir in the previous artiles for a while.
Now I think it is time to start talking about web development using Elixir.
One of the most popular framework to do that is Phoenix which is built on top of Elixir and uses all its advantages.
In the previous articles, we have covered how to work with the processes in Elixir on a low level.
We have also covered what kind of wrappers exist around processes. That can help us to avoid writing that low-level code. Yes, I am mentioning Agents and Tasks now.
Now it’s time to get familiar with OTP and its features called GenServer and Supervisors.
Let’s dive in.
In the previous article
we have covered the basics of working with multiple processes.
In order to make it properly work we need to implement several things.
We need recursively listen to messages, we need to handle timeouts and send messages.
That looks like a lot of stuff which can lead to mistakes. To prevent that, Elixir provides us nice wrappers around processes such as Agents and Tasks.
Agents allow us to keep a state and Tasks help us to run processes in parallel.