The Pragmatic Programmer Erlang Screencasts

I've been meaning to get around to playing with Erlang for a while now. Tonight I set aside 30 minutes to watch the first of the Pragmatic Programmer's Erlang Screencasts by Kevin Smith: Erlang By Example.

Each screencast is very reasonably priced at $5 a piece. I bought the first one, in which you learn how to build a simple online chat system (see the introductory video for an overview of what's covered in the entire series).

Installing Erlang

While the video was downloading I kicked off the installation of Erlang on my Mac with MacPorts...

$ sudo port install -d erlang

and grabbed a copy of the Erlang TextMate bundle:

$ cd ~/Library/Application\ Support/TextMate/Bundles
$ svn co
$ osascript -e 'tell app "TextMate" to reload bundles'

Following along

If you've never done any Erlang at all (and to all intents and purposes, I hadn't) then you'll see quite a bit of new syntax during this screencast. It won't all be explained to you straight away, but don't worry about that as it doesn't detract from what's going on.

Kevin edits his code in Emacs and compiles it with some magic incantation using an Erlang interpreter that is running in an Emacs buffer. It seems to be assumed that when you start watching the screencast you already know how to compile a code module. Worry not; if you're trying to run the examples in a terminal, you should be able to get by with something like this:

$ erl
Erlang (BEAM) emulator version 5.6.2 [source] [async-threads:0] [kernel-poll:false]

Eshell V5.6.2  (abort with ^G)
1> c('message_router').

c means "compile". Note the . character, which is used as a terminator in Erlang. If you're using Emacs you'll be pleased to hear that Kevin has shared his Emacs configuration on his blog.

The video does a good job of giving you a flavour of concurrent programming in Erlang. Concentrating on the syntax would have distracted from the overall message, without contributing much to your understanding (and if you really must know the syntax, there's plenty of Erlang documentation that will fill in the gaps).

Once the simple chat system was put together the code was refactored. While recompiling my edits and fixing my typos I picked up some useful tips on using the interactive interpreter.

So in summary, I enjoyed it. I'm a long way from being able to claim that I know Erlang, but I know hell of a lot more about it than I did half an hour ago, and you can't say fairer than that! For $5 a throw, the screencasts are a bargain.

Useful links

I love feedback and questions — please feel free to get in touch on Mastodon or Twitter, or leave a comment.

Published on