[Erlang] Programming Erlang (Pragprog)

by Joe Armstrong

A multi-user game, web site, cloud application, or networked database can have thousands of users all interacting at the same time. You need a powerful, industrial-strength tool to handle the really hard problems inherent in parallel, concurrent environments. You need Erlang. In this second edition of the bestselling Programming Erlang, you’ll learn how to write parallel programs that scale effortlessly on multicore systems.


Using Erlang, you’ll be surprised at how easy it becomes to deal with parallel problems, and how much faster and more efficiently your programs run. That’s because Erlang uses sets of parallel processes—not a single sequential process, as found in most programming languages.

Joe Armstrong, creator of Erlang, introduces this powerful language in small steps, giving you a complete overview of Erlang and how to use it in common scenarios. You’ll start with sequential programming, move to parallel programming and handling errors in parallel programs, and learn to work confidently with distributed programming and the standard Erlang/Open Telecom Platform (OTP) frameworks.

You need no previous knowledge of functional or parallel programming. The chapters are packed with hands-on, real-world tutorial examples and insider tips and advice, and finish with exercises for both beginning and advanced users.

The second edition has been extensively rewritten and covers Erlang R17 features. New to this edition are seven chapters covering the latest Erlang features: maps, the type system and the Dialyzer, WebSockets, programming idioms, and a new stand-alone execution environment. You’ll write programs that dynamically detect and correct errors, and that can be upgraded without stopping the system. There’s also coverage of rebar (the de facto Erlang build system), and information on how to share and use Erlang projects on github, illustrated with examples from cowboy and bitcask.

Erlang will change your view of the world, and of how you program.

Don’t forget you can get 35% off the ebook using the code ‘devtalk.com:023:

5 Likes

In my ongoing endeavor to learn Elixir, Programming Erlang was the second book I read; the first being Programming Elixir >= 1.6.

This may seem like an interesting trajectory for an Elixir noob, but in retrospect I think it was an excellent decision, given my background and learning style.

Here’s how it is: I’m a Java programmer by trade with almost 20 years under my belt, and along the way I’ve dabbled in other JVM languages like Groovy, Scala, and Clojure, with the latter capturing my attention the most.

So, my background is working in the language “closest” to its virtual machine, and branching out from there.

Also, my learning style favors a linear, comprehensive, foundational approach: I seek out materials and approaches that imply “okay, if you just stick with this path, you’ll have a solid foundation by the end.”

I think this is why a gravitate towards books instead of blogs, tutorials, etc.

At any rate, I worked through half of Programming Elixir >= 1.6 and felt a bit lost; things were going too fast for me.

That’s when I thought, “Okay, let’s slow down. What can I read that appears to be foundational and comprehensive?”

I landed on Programming Erlang because things don’t get any more foundational than Erlang and I knew I was in for a treat, having previously read Joe Armstrong’s doctoral thesis; I’m delighted to say it was everything I was hoping for.

It’s clear that Joe had a real gift for explaining things; the prose is patient yet concise and digs into details without belaboring the point.

The progression from sequential programming to concurrency feels steady and natural; by the time we reached concurrency I was ready to see what it was all about. (This is in stark contrast to the premise of tackling concurrency in Java, which is scary and better left to the experts.)

The latter third of the book provides a lot of valuable exposure to other details of the BEAM and its ecosystem, e.g., distributed programming, tracing, logging, monitoring, etc.

In all, this was exactly the sort of foundation I was seeking and I feel that my subsequent and ongoing travels in Elixirland have benefitted tremendously from my side-trip into Erlang.

3 Likes

Fantastic review, thanks for posting Ted!!

I had originally planned to read this book after all my Elixir books, but your review has made me want to read it sooner.

Only thing is I miss Joe, and reading his book will probably make me feel quite emotional :cry:

I think I might read it after Programming Phoenix, since I’ll have gotten most of the beginners books out of the way and the rest are mainly about OTP, systems architecture or more advanced topics.

Did you read the book start to finish? Is that how you recommend it is read?

1 Like

And thank you for the nudge in posting the review! :023:

My trick was to play a cycle of “Hello Robert / Mike / Joe!” in my mind at every ah-ha moment, of which there were many. :smile:

That might work out really well; the last handful of chapters are about OTP and systems, starting with building up a hand-rolled version of GenServer.

That’ll probably be a really nice segue into your remaining reading list.

Yes, I usually read books cover-to-cover, even on the occasion when they suggest jumping around because I’m usually seeking that foundation and exposure.

I recommend reading this one start-to-finish: there’s no overarching project being built throughout the book, but the chapters do build on each other.

And even in the introductory “this is a list, this a tuple, …” material, there were plenty of nuggets that had me thinking “okay, so that’s why Elixir does what it does”, although YMMV because I only had a very rudimentary familiarity with Elixir at the time.

1 Like

Thanks for the insight Ted :smiley:

One more question, you mentioned:

So would I be wrong to assume this is a good candidate to be read on an e-reader? Where I don’t need to be in front of a computer to follow along with examples etc?

Actually one more question :lol:

The book is quite large at 546 pages :icon_eek: did it take you long to read? I generally prefer shorter books, because I like seeing the % progress quickly (it makes me feel like I am making good progress :lol:)

1 Like

You’re good to go: I read it on a Kindle Paperwhite in landscape orientation and I don’t recall any reading woes or having to jump back to code examples.

Yeah, it’s a biggie. :smile:

I don’t quite remember how long it took, mainly because I got interrupted with another book I had to read for work.

But it didn’t feel too long because:

  • I was getting so much foundation
  • Joe’s writing style is great

And if it helps, you could consider it as four books in sequence, given the way the book is structured into four parts:

  • Sequential Erlang
  • Concurrent and Distributed Programs
  • Programming Libraries and Frameworks
  • Building Applications
1 Like

Looks like I’m late to the party, hopefully I’m not too late. I’ve been going through this book for the past fews days, currently on lesson 4. I’m stuck wrapping my head around the below list comprehension example on page 63. It deals with anagram.

perms([]) -> [[]];
perms(L) -> [[H | T] || H <- L, T <- perms(L -- [H])].

I’ve difficulty in comprehending how the generator for T works; T <- perms(L -- [H]). I assume perms is supposed to build a list, how’s that going to work?
Thanks a bunch.