Sunday, February 17, 2013

Book review: Learn You Some Erlang For Great Good!

I've been aware of Erlang for almost a decade now. It's a programming language that's a pioneer in concurrency— created in 1986, before concurrency and parallelism were even a concept.

Impressed with Erlang's forward thinking, I tried several times to pick it up, but I couldn't get past the first few programs. When I got an opportunity to read and review Learn You Some Erlang for Great Good! published by No Starch Press, I jumped at the chance. The book is a printed and professionally edited version of the original free online book.

The first five chapters got me to write some basic stateless programs, useful to solve small problems. I found it very helpful that these first chapters provide comparisons to a procedural language that the average reader is used to — it's a comfortable baseline.

Chapters 10 and 11 explain how to write Erlang's equivalent of a class in procedural languages — a thing that has state in addition to behaviors. Erlang's version of this easily lends itself to running on a separate machine. With this functionality, I was able to implement an algorithm that features behind-the-scenes memoization. (That's the state.)

Later chapters introduce more advanced concepts that help me to think in Erlang and to write idiomatic code. For example, Chapter 15 describes a finite state machine design pattern. Another describes Erlang's way of propagating and handling errors. And so much more.

The author does a great job of introducing topics in a logical manner and without overwhelming the reader. Or maybe it's the comforting whimsical artwork that popularized the LYSEFGG style and flows through every chapter of this book.

As an Erlang novice, I have two complaints with this book. The first is, it doesn't discuss IDEs. I understand Erlang IDEs aren't as developed and polished as for other languages, but still — they exist. The book has you use a text editor combined with compiling your erl file by hand in the interactive shell. It's way less convenient than I'd like it to be.

The second complaint is that it doesn't mention the Erlang Debugger. Maybe in Erlang a debugger is less significant than in an imperative language, but it still seems worth a mention and some examples.

While I have a long way to go before I understand and know Erlang as well as I do other programming languages, after reading the first half of the book I feel significantly more at home with it.

(Thanks to O'Reilly Media for providing me with a copy for review.)

No comments:

Post a Comment