Taking our knowledge to the next level, these lessons get cover the advanced topics of Elixir and the BEAM.
We’ve looked at the Elixir abstractions for concurrency but sometimes we need greater control and for that we turn to the OTP behaviors that Elixir is built on.
In this lesson we’ll focus on the biggest piece: GenServers
Supervisors are specialized processes with one purpose: monitoring other processes. These supervisors enable us to create fault-tolerant applications by automatically restarting child processes when they fail.
We can run our Elixir apps on a set of different nodes distributed across a single host or across multiple hosts. Elixir allows us to communicate across these nodes via a few different mechanisms which we will outline in this lesson.
Metaprogramming is the process of using code to write code. In Elixir this gives us the ability to extend the language to fit our needs and dynamically change the code. We’ll start by looking at how Elixir is represented under the hood, then how to modify it, and finally we can use this knowledge to extend it.
A word of caution: Metaprogramming is tricky and should only be used when necessary Overuse will almost certainly lead to complex code that is difficult to understand and debug.
Sometimes a project can get big, really big in fact. The Mix build tool allows us to split our code into multiple apps and make our Elixir projects more manageable as they grow.
In this lesson we will learn about
@spec is more of a syntax complement for writing documentation that could be analyzed by tools.
@type helps us write more readable and easier to understand code.
We learned about Typespecs in the previous lesson, here we’ll learn how to require a module to implement those specifications. In Elixir, this functionality is referred to as behaviours.
In this lesson we are going to look at Protocols, what they are, and how we use them in Elixir.