Learn Erlang Step-By-Step

East Branch Software built this tutorial to teach Erlang

TUTORIAL LESSONS

0 - System Setup and Your First Project
1 - Your First Erlang Module
2 - Pattern Matching - Erlang’s Superpower
3 - Recursion
4 - Higher-Order Functions
5 - List Comprehensions and Data Manipulation
6 - Records and Complex Data Structures
7 - Error Handling and Exceptions
8 - Introduction to Processes
9 - Basic Process Communication
10 - Links and Monitors
11 - Understanding OTP Principles
12 - GenServer Basics
13 - Building Your First GenServer
14 - Supervisor Patterns
15 - TCP Socket Programming
16 - HTTP Request Handling
17 - The WebSocket Handshake
18 - WebSocket Frames
19 - Building the Chat Server Core
20 - Real-Time Message Broadcasting
21 - User Authentication and Sessions
22 - Chat Rooms and Channels
23 - Unit Testing with EUnit
24 - Integration Testing with Common Test
25 - Production Deployment
26 - Monitoring and Logging
27 - Performance Optimization
28 - Database Integration
29 - Distributed Systems Basics
30 - Node Discovery and Clustering
31 - Distributed Chat Architecture
32 - Fault Tolerance in Distributed Systems
33 - Hot Code Reloading
34 - Advanced Security
35 - Scaling Strategies
36 - Operations and DevOps
37 - State Machines with gen_statem
38 - Event Handling with gen_event
39 - Integration and APIs
40 - The Final Project and Where to Go Next

3 Likes

Sorry, I don’t want to come across as a grumpy old man, but the description of “…learn Erlang before learning its Ruby-inspired modern incarnation…” is, in my view, not entirely accurate. Elixir is certainly not a replacement for Erlang or an upgrade of it. It’s simply a different programming language with a very different approach and set of applications.

Here and there I keep running into some inaccuracies, such as in chapter 3, Recursion, under the heading “Important Note: Anonymous Functions and Self-Reference”, where you state that an anonymous function cannot call itself — but that hasn’t been true since Erlang 17. As you can read in LYSE Anonymous functions with internal names:

PrepareAlarm = fun(Room) ->
    io\:format("Alarm set in ~s.~n",[Room]),
    fun Loop() ->
        io\:format("Alarm tripped in ~s! Call Batman!~n",[Room]),
        timer\:sleep(500),
        Loop()
    end
end.

I think some exceptionally good books have been written in the past for learning Erlang. Even though they are somewhat older now, they are still relevant, especially when it comes to the basic principles. Rather than yet another introduction to the language, I personally would have written something about the tooling around Erlang (rebar, ELP, ct, etc.) and referred to existing material for Erlang itself. The books mentioned there are all of top quality.

3 Likes

Yeah, I guess it’s heavily AI-assisted, why not.

In the “Installing Erlang” section, for macos they list only Homebrew as the recommended method. Call me old-fashioned, but I prefer MacPorts. I’d list both.

The editor/IDE, LSPs, and code formatters are not even mentioned. Okay, that’s arguably out of scope for the tutorial, but a proper setup for working with Erlang code is something many beginners would be grateful for.

In the list comprehensions section, strict generators aren’t used, and they align better with the “Let it crash” philosophy. But maybe that’s because the chapter was created or updated only two months after Erlang/OTP 28, where they were introduced.

OTP is explained as:

A counter or a key-value store would look the same, with different messages and state. OTP is the set of libraries and conventions that ships with Erlang, and its central idea is to write that shared shape once and reuse it.

Hmm… maybe that’s correct, but it misses the very fundamental point of OTP.

Or this one:

Understanding Recursion

In programming, recursion breaks big problems into smaller, similar problems until we reach a simple case we can solve directly.

I’m afraid that’s not quite what recursion is about.

Overall there’s a lot covered, and maybe it’s fine for a tutorial of this kind.

My thoughts, too.