Erlang Programminggnalre writes "Some time ago I reviewed Programming Erlang. My opinion was that it was good beginner's book, but I set the challenge for a book for the more advanced Erlang developer. It shows the power of a Slashdot review that only after a two scant years a new set of Erlang books are about to be published.The first of these new books is the imaginatively tiled "Erlang Programming" (ISBN 978-0-596-51818-9) published by O'Reilly therefore exhausting the possibility of any other books using the words 'Erlang' and 'Programming'. So does this book answer my challenge? And just as importantly is it any good? To find out these answers read on.....
The book is written by Francesco Cesarini and Simon Thompson. Before I begin the review, a public confession is needed. Many years ago Francesco and I worked together. I first met him when he was hired to provide training and support in Erlang. Wearing me down over many long lunches, he got me to appreciate Erlang's beauty, simplicity. In fact whenever people ask (or beg) me to stop telling them how Erlang is better than the language they are currently using, I often think of Francesco's enthusiasm for the language. Since then he has gone on to create his own company erlang training and consulting, which has allowed him to consult with many of the main Erlang users, as well as maintain his involvement in the development of the language. Of course you are quite within your rights to ask how I can remain unbiased in this review, but I can assure you that while I have made it known that I am open to bribes; none so far have been forthcoming. The Review
I am always intrigued by what metaphor O'Reilly books is trying to convey with there choice of animal covers(the warty toad for windows XP unleashed instantly comes to mind). In this case the bush tailed rat kangaroo image is used and I am struggling to see the connection with Erlang. Especially when (considering Erlang's Swedish roots) something like a moose would seem more appropriate (you may add your own Holy Grail moose jokes here).
The book itself is in the usual clear O'Reilly style and consists of 20 chapters split over 450 pages. The introduction starts out by setting out why you should be interested in Erlang by emphasising it strengths. It does indicates that some programming experience is expected, but the book does not make to many demands in that area (however an open mind is useful unless you have met functional languages before).
One interesting nugget of information is how many well known web and software development companies currently utilise Erlang in some way. Erlang has come a long way from its telecom's roots, with companies such as Amazon, Yahoo and Facebook routinely developing applications in it. In many ways it rivals Lua as the most popular computer language that no one has heard of (Please debate). If nothing else at least you know where to send your C.V. after reading the book.
As you start reading the book it quickly becomes apparent that the book is not intended purely as a language reference, but also a tutorial on how to create Erlang applications. The author's industrial and consulting experience shine through here, with information at every stage on the best development approaches and possible pitfalls. One of the things I consistently liked about the book is that when the authors felt there is a weakness in Erlang they did not gloss over it, but instead highlighted it and described the best methods to overcome them.
The simplicity of the language means that the basic syntax of the language is covered in less time than most languages takes to explain their data types. By the time Chapters 2 and 3 are finished a reader should know enough to create their first Erlang program. Chapter 3 also provides a good description of recursion, which is of fundamental importance when programming Erlang, and a considerable headache to those of us born without in-built stack pointers.
However using Erlang as a sequential language would be like using a mobile phone to hammer in a nail. Erlang is about parallel programming and in Chapter 4 we get to Erlang's real strengths. This chapter takes the reader through the primitives available to write parallel programs. It also makes a good attempt at explaining the misconceptions about Erlang's light weight processes, especially to programmers formerly only aware of threads and normal processes. It explains how you must move away from the idea of processes being heavy weight objects to be used sparingly, to the Erlang philosophy of using processes as almost disposable objects.
In Chapter 5 the book starts getting more adventurous by describing common Erlang process design patterns. These patterns are intended to simplify many of the type of programming situations that you are likely to come across such as Client/Server. This is a good starting point for your first Erlang application. Chapter 6 goes onto explain what to do when Erlang programs go bad by describing the handling of faults and the recognition of process failures.
The functionality that most impressed me when I met Erlang was its capability to "hot swap" its code. Would'nt it be great if all languages had the same capability. Of course Erlang's much vaunted "high availability" moniker would not be achievable without this feature and Chapter 8 provides a good overview on how to achieve it in your own programs.
It is in chapter 9 that the book makes a stunning admission — Erlang is a functional language. Presumably the authors took so long to come clean about this in the hope of seducing programmers who hold a prejudice against such languages. After this shock admission, the chapter goes on to state Erlang's functional programming credentials
A language more often than not succeeds or falls because of its libraries. In Erlang this is provided by OTP (OTP stands for Open Telecom Platform. The name itself is a hangover from Erlang' days as a language for writing telephone exchange switches). In Chapter 10 the book starts describing some parts of the OTP, starting with ETS, the memory based database and its disk based cousin DETS. In fact (D)ETS are a important part of Erlang providing an efficient way to store and retrieve large amounts of data shared between processes.
Chapter 11 and 12 expand on previous chapters describing how to extend Erlang concurrency to distributed systems, and explains how the the design patterns described in chapter 5 are formalised by the OTP behaviours library.
In chapter 13 we meet Mnesia. Mnesia is probably one of the most powerful components of the Erlang OTP library, a database system written in Erlang and taking advantage of Erlang's concurrency and robustness. As the book itself admits, Mnesia may not be the right tool for every situation. Even so Mnesia is an essential application to learn if you wish to understand Erlang and the subject is probably worthy of a book itself, so one chapter, however well written, can only scratch the surface.
In chapter 14 the book describes how to attach a GUI to Erlang using the Erlang binding to the wxWidgets C++ Library. To someone who learned the old TK GUI wrapper that made your applications look like they were designed in the 60's this is definitely an improvement. Chapter 15 explains how to utilise the OTP network libraries, while Chapter 16 looks at how to interface with other "lesser" programming languages, such as Java and C.
The book finishes off by describing some of the Erlang development tools for documentation and automated testing which we all intend to use but never quite get round to investigating (all our code is self-documented and perfect, right?)
Chapter 20 finishes the book off with timely a reminder on writing Erlang in a good coding style. Conclusion
So is this the ultimate book for the advanced Erlang programmer? The answer is not quite. For example there are areas that I would have liked more detail on. As I have already mentioned, Mnesia is worthy of a book to itself, so a solitary chapter was never going to cover it in enough depth. Also while certain areas of the OTP library are discussed, the majority is only lightly touched on and anyone who is serious about Erlang development will eventually need to gain a better understanding of this area. Finally at some point the problem to be solved becomes as important as which language is used. A description of how Erlang is used in some of its flagship applications would be welcomed. However this is probably just my feeling since I was indoctrinated by Erlang years ago (and own an Erlang tee shirt and mug to prove it). Anyone who has not investigated Erlang before will find plenty of advanced concepts throughout the book.
It also is worth considering what has changed since the last Erlang book was released. Since that time, Erlang is no longer alone in its niche(highly reliable concurrent systems.) with languages such Scala also being promoted. On the opposite side of the coin, Erlang has increasingly found new applications in supporting many of the new Web 2.0 and cloud architectures arising today, a usage the Erlang language inventors could not of foreseen when they designed it. Any new book therefore needs to address these new usages. This book fulfills that function very well, bringing Erlang documentation into line with its current usage.
Most importantly is the book any good? The answer to this has to be an unreserved yes. The training and industrial experience of the authors is always apparent and combined with the O'Reilly style it has produced an excellent up-to-date book for any person starting their Erlang development or for someone who is just interested in dipping in their toe for the first time.
Tony Pedley is a senior engineer specialising in real-time embedded systems. In his spare time he likes to arrange his O'Reilly books in a taxonomic hierarchy."