A day for reading and playing with Dave’s code.
I’ll be keeping the duper
source around for future reference to starting multiple servers.
Programming Elixir Chapter 18 Notes
OTP: Supervisors
In order to reliably remember a value, we spin up a process that does nothing except remembering. This isolates the information storage, which has maximal reliability, from information manipulation, which can have all sorts of problems.
[Read More]Programming Elixir Chapter 17 Notes
OTP: Servers
Dave discusses an alternate component-based approach to writing GenServers. This consists of modules in three files:
- A public API to hide the GenServer complexity.
- The GenServer interface.
- Implementatation.
The public API is just a wrapper to the GenServer functions and the GenServer functions are just a wrapper to the implementation. This hides the GenServer call/cast complexity and isolates the implementation.
I like this approach, but think that breaking it into three files is too complex. If the public API is only a wrapper to the GenServer API and the GenServer API is only a wrapper to the implementation, we can easily put them into a single file.
My approach implements the GenServer in two files:
- Public API which calls the GenServer functions.
- Implementation
Programming Elixir Chapter 16 Notes
Nodes-The Key to Distributing Services
Atoms can be registered globally across all nodes. This allows us to, for example, find the one generator in a set of nodes.
One globally registered atom is the group leader. All IO is done through the group leader. Exercise #4 demonstrates how the group leader can be managed.
[Read More]Message Ordering
Some side reading
The Erlang blog post, A few notes on message passing, describes how interprocess message passing works.
The most important takeaway for me is that messages have a defined order.
[Read More]Programming Elixir Chapter 15 Notes
Working with Multiple Processes
Elixir/Erlang processes are not operating system processes.
[Read More]Actors
It's About Time
For me, the lure of Elixir is Actors.
[Read More]Programming Elixir Chapter 14 Notes
Tooling
Working through all the tooling examples.
[Read More]Programming Elixir Chapter 13 Notes
Organizing a Project
Spent a lot of time Googling in order to complete exercise #4. Wrapping my head around piping and enumeration. Testing helps. Short snippets in LiveBook helps. Practiced documenting.
[Read More]Things are Starting to Click!
OrganizingAProject-4
Back in college I struggled with Calculus; had a hard time grasping the concept of the day. After a semester break, I’d ace the test reviewing previous topics. Just took awhile for the concepts to settle into my brain.
I’m experiencing a similar effect with Elixir. Came back after a few days and was able to make significant progress on Chapter 13’s Formatting a Table exercise.
Things are starting to click.
[Read More]