4. A bit 'of numbers referring to WhatsApp
35
The engineers who worked for WhatsApp before
acquisition
450.000.000
WhatsApp users before
acquisition
5. Erlang and the BEAM
● Light-weight process
● No memory sharing
● Code hot-swap out of the box
● Actor modeling
● Battle tested virtual machine
6. My trouble with Erlang
● Prolog-inspired syntax
● Single assignment
sometimes is just as
problematic as
destructive assignment
● Strings-as-lists sucks
7. What if I told you that you can have all the advantages, and no flaws?
13. ExUnit
● Simple macros help defining
readable tests
● ExUnit.DocTest implements
functionality similar to
Python’s doctest.
● ExUnit.Callbacks defines both
setup_all and setup callbacks,
as well as the on_exit/2
facility
● You can define the test as
asynchronous by adding “async:
true” in the use statement
14. Credo
A static code analysis
tool for the Elixir
language with a focus on
teaching and code
consistency.
15. Credo
● shows you refactoring
opportunities in your code
● shows complex or duplicated
code fragments
● warns you about common
mistakes
● shows inconsistencies in your
naming scheme
● helps you enforce a desired
coding style
26. Polymorphism
Finally, it is important to specify that by using pattern
matching you can implement polymorphism, indeed, you can set
the same function multiple times, so as to cover different
patterns with different behaviors
28. Spawn a process
In Elixir, all code runs
inside processes. Processes
are isolated from each
other, run concurrent to one
another and communicate via
message passing. Processes
are not only the basis for
concurrency in Elixir, but
they also provide the means
for building distributed and
fault-tolerant programs.
29. Link and Monitoring
The majority of times we
spawn processes in Elixir,
we spawn them as linked
processes.
When two process are linked
the failure in one process
propagates to the other.
Finally, we can set up a
monitor so that the parent
process will receive a
notification every time a
child exits
30. Why processes are so important?
Obviously the processes are
primarily a tool to perform
parallel computations, but thanks
to the BEAM and the infinite number
of processes that can run on the
inside, they have become something
more…
32. OTP
No, this not means one time
password
The Open Telecom Platform
is a collection of
Middleware, libraries and
tools
33. Tasks, Agents, GenServers, GenEvents...
Tasks
meant to execute
one particular
action throughout
their lifetime,
often with little
or no
communication with
other processes.
store state that
must be accessed
from different
processes
Agents
standard set of
interface
functions,include
functionalities
for tracing and
error reporting
GenServers
event manager
process with an
arbitrary number
of event handlers
which are added
and deleted
dynamically
GenEvents