As the title says, I just learnt GenServer, Tasks and Supervisors.
PragmaticStudio course on Elixir & OTP is awesome. I learnt how they can be implemented from scratch as well.
I was scared of those names, thinking they will be as complicated as some of the other languages, but damn.
I am so happy. Even wrote a rudimentary Cron job with GenServer!
So, seniors, what else should I know from OTP land?
I want to learn as much as possible before Phoenix 1.7 final release, so I have the full picture. (I purchased 4 books, but asking if I should get even more.)
P.S. LiveBook is tremendously helpful. I am spawning and killing processes left and right.
P.P.S. Is there a :hydra restart strategy, so when I kill a process, 2 take its place!
DynamicSupervisors, Registry
PubSub(both Phoenix.PubSub and :pg), Presence, these two demistify a lot about phoenix channels and liveview and it still blows my mind it all works out of the box.
:gen_statem is useful from time to time though rare in most webapps I’ve seen
Composing ecto queries to dinamically generate filters
And in general something about immutable data structures and how to traverse data, which is super simple but looks complicated at first. You can write a full blown schema validation library with very little code.
These are things that I found to be super useful in an almost day to day basis or in general tools I’m glad to have in my toolbelt
Yesss those tools are so cool, I felt exactly the same way. Other stuff I liked learning about
the Erlang Observer
ETS tables
binary pattern matching
Also https://protohackers.com/ is a fun way to learn about some of these concepts (including genservers, supervisors, tasks, etc) if you like that sort of thing, there’s a forum thread on it somewhere, worth poking at it to see if you think it’s fun
I will keep reading and updating here about the progress I make. And will keep asking for more to learn.
Just learning the basics have cleared so much doubt in my mind and opened up so many possibilities. I can’t imagine how it will feel like, once I know everything.
Folks here covered almost everything I was going to say. One thing though, yesterday while solving an advent of code problem I decided if I could use gen_fsm … always wanted to do that. Apparently it’s gen_statem now and really loved the way it made me think, so that could be one OTP goodness you can add? I’d also throw in a gen_event here.
Oh yes and to piggy back off the gen_* things… GenStage and Broadway are quite nice. Even if you don’t need them you can learn a lot reading how they are implemented.
+1, In the same spirit I’d recommend to learn about IO lists / IO data as well (the secret sauce which makes Elixir/Phoenix so efficient for web stuff):
Example please. Is there another elixir thing apart from pipes for this?
Are you talking about with?
I definitely want to use it.
Before starting with Elixir, I asked my colleague, what happens to cron jobs, while apps restarts or different kinds of deploy strategies are used, or system restarts.