Learn how to write Erlang programs by sitting next to an experienced Erlang programmer as he builds a full-featured application from the ground up!

In these screencasts, Kevin Smith incrementally builds a distributed chat system using Erlang. You’ll learn first-hand how each aspect of the Erlang language fits together into a real-world application, starting with Erlang primitives and ending with an OTP application.

*NOTE: THESE SCREENCASTS ARE NO LONGER FOR SALE *

About this Screencast

  • Watch the preview highlighting the Erlang chat system Kevin builds in these screencasts.
    (1 min, QuickTime | Ogg)

Contents and Extracts

Throughout these screencast episodes, you’ll get inside the mind of an experienced Erlang programmer: his thought processes, his development techniques, the tools he uses, and the tricks of the trade. You can follow along with each twist and turn as he adds new features and refactors existing code to shape the application over time. You’ll also see how he troubleshoots problems that crop up along the way. You’ll not only learn more about Erlang, you’ll also see ways to streamline your development workflow.

  • Episode 1: Sending and Receiving Chat Messages

    We’ll send and receive messages between a chat client and a message router running in a single Erlang node. You’ll learn how to:

    • send messages to other Erlang processes
    • use a receive block to receive messages from other processes
    • use tuples to pattern-match messages
    • spawn new processes
    • implement tail recursion
  • Episode 2: Messaging Clients By Nickname

    We’ll create a client nickname directory using an Erlang dictionary so that clients can send messages to each other using the nickname. You’ll learn how to:

    • pass function references between processes
    • use a dictionary to register chat clients by nickname
    • register processes with the Erlang runtime
    • create anonymous functions
    • refactor Erlang code
  • Episode 3: Distributing Clients In A Multi-node Environment

    We’ll take the single-node chat application and distribute it across multiple Erlang nodes using distributed Erlang features. You’ll learn how to:

    • set up two (or more) Erlang nodes
    • use distributed Erlang to exchange messages across nodes
    • use the global module with distributed locking
  • Episode 4: Storing Messages in the Mnesia Database

    We’ll add store and forward capabilities for more robust messaging using the Mnesia database. You’ll learn how to:

    • create Mnesia records and an Mnesia database
    • store messages for offline chat clients
    • query Mnesia using the QLC module
    • forward stored messages to online chat clients
    • delete messages in an Mnesia transaction
  • Episode 5: Unit Testing with EUnit

    Testing is the cornerstone of writing software that works. In this episode, we’ll take a break from the chat system and focus on how to do test-driven development in Erlang using the EUnit testing framework. You’ll learn how to:

    • get started with EUnit
    • write test specifications with EUnit macros
    • use EUnit test generators to add flexibility to unit tests
    • set up and tear down test environments, such as server processes
    • run multiple tests in batch with a test suite
    • write code in a test-first style
  • Episode 6: Adding REST Support with MochiWeb

    It’s time to scale our chat system out to the web! In this episode, we’ll use the MochiWeb toolkit to make our chat system available to HTTP clients using REST conventions. You’ll learn how to:

    • download, build, and install Mochiweb
    • write a basic Erlang web server using MochiWeb
    • use Erlang’s experimental support for parameterized modules
    • add REST-style endpoints to the chat system developed in previous episodes
    • register, send messages, and poll for messages from HTTP clients
    • take advantage of Erlang’s excellent concurrency support and inexpensive processes to scale for the masses
  • Episode 7: Writing Servers with gen_server

    In the first half of this episode, we’ll learn how to write Erlang server processes using gen_server, a module in the OTP library. Then, in the second half of this episode, we’ll put what we learned into practice by incrementally refactoring two of our home-grown servers to use gen_server. As a result, you’ll be able to immediately apply gen_server to your next Erlang server process or one you’ve already written. You’ll learn how to:

    • write a generic Erlang server process using gen_server
    • design systems that decouple the message dispatch loop from the code that handles the messages for better reuse
    • send RPC and cast-style messages
    • initialize and shutdown gen_server processes
    • scope the server to control who sees the server and who can send messages to it
    • apply gen_server to a real-world problem
    • refactor existing servers to use gen_server
  • Episode 8: OTP Supervisor and Application Behaviors

    In this final episode, we’ll focus on two mechanisms that OTP provides to manage the lifecycle of processes in an application: supervisor and application behaviors. We’ll write a Web Supervisor and a Messaging Supervisor to manage those subsystems, and then layer another meta-supervisor on top to manage the entire chat system. You’ll learn how to:

    • implement an OTP Supervisor behavior to start, stop, and monitor worker processes
    • write child process specifications
    • handle messages sent from monitored processes
    • nest supervisors into hierarchies of supervision for better process management
    • implement an OTP Application behavior to easily start-up and gracefully shutdown an entire application
    • refactor existing code to be supervisor-friendly
    • a trick for starting Erlang systems from shell scripts, such as Unix init scripts

Audience

These screencasts are designed for programmers who have a general feel for Erlang syntax, although you can follow along if you know any programming language.

About the Author

Kevin Smith has, at various times, been a network administrator, DBA, developer, and team lead. In 2006 he discovered Erlang and immediately wondered why more people weren’t using it. Since his discovery Kevin has been writing and blogging about Erlang at his blog. Currently, Kevin is a developer at Engine Yard where he uses his Erlang skills only for good.

Comments and Reviews

  • Chris Williams said:

    Think of the book as a guide to the basics and then once you get over the aforementioned syntax spike, switch over to the screencasts – they are awesome!

    President/CEO Iterative Designs LLC
  • Outstanding series!

    —Lloyd R. Prentice
  • Coders' Hangout said:

    I HIGHLY recommend the Erlang screencasts if you are into Erlang. The Erlang community needs more content creators like this. You won’t regret it. And seriously, $35 for HOURS of Erlang content?? How can you beat that?

  • Alain O'Dea said:

    These screencasts are a great companion to Joe Armstrong’s book. I highly recommend both to anyone investigating Erlang or looking to round out their Erlang skill-set.

  • Mike Riley said:

    Throughout the series, I felt as if I were peer programming on my first day at the job with a seasoned veteran.