on 18 September 2007
This book is outstanding. It's easy to read, fun and, maybe, exciting. The exposition is lucid, and exploits a practical, hands-on, example-driven approach throughout. I enjoyed both the breadth and depth of coverage. It interweaves working code with full, clear explanation, background and valuable insight. It felt like discovering chair-lifts after years of sidling up mountain slopes on ski's.
Erlang and OTP are comparable to Java and core J2EE. Erlang/OTP is freely available, Open Source, software from Ericsson, the telecoms company. Erlang has several impressive attributes, but one is Ericssons claim it is used in telecom's hardware to deliver 99.9999999% (roughly 1 second in 30 years) availability, beating most Enterprise applications by a few 9's.
The excellent roadmap in chapter 1 explains the books organisation and chunking of content; roughly: sequential programming, concurrent programming, distributed programming, interfacing, data storage, databases, OTP and multi-core programming. There is good depth to the content. The order of material can be a little strange, but if you are familiar with programming, it's likely straightforward.
The book sets off at a good pace, quickly getting up and running with 'sequential Erlang'. Unlike many programming books, Armstrong deals with the practical nitty-gritty of downloading, installing, compiling, debugging and running Erlang on Mac, Linux and Windows. He returns to development practicalities at several points to support the increasing sophistication of applications. I felt that he really wants to make learning and applying Erlang straightforward, and he succeeded for me; everything worked 'silky smooth'.
The sequential subset of Erlang is a dynamically-typed functional programming language with all of the usual bits, like: single assignment, pattern matching, list comprehensions, first class functions, exceptions, etc. In use, Erlang feels as much like strict Scheme, with helpful syntax, as statically-typed FP languages like Haskell, OCaml, or Standard ML.
Next Armstrong introduces concurrency with light-weight processes, Erlangs powerful message passing mechanism, and failure handling. This is where this book really takes off. Before we're 1/3rd in, we can exploit our dual or quad-core processors, be ready for future many-core chips, with minimal complexity, and handle process failure by 'healing' the system. Gulp!
Distributed Erlang starts setting things up for the later OTP chapters by applying the distributed computing mechanisms. Erlang implements distributed systems by distributing multiple nodes (Erlang VMs) on and across machines. The earlier concurrent stuff, like messaging and failure handling, easily extends to this environment.
The Erlang data storage chapters on ETS, DEST, and Mnesia, the distributed real-time database, have working examples. I would have liked more depth on Mnesia, but there is on-line documentation at erlang.org. Interfacing covers TCP/IP, HTTP clients and servers, UDP, and integrating with external C programs and internal 'drivers'. There are plenty of nifty examples woven throughout, so enough to keep me experimenting.
The crowning glory is OTP. This provides components and frameworks for building distributed systems which require very little extraneous code or configuration. OTP implements distribution, fault-tolerance, self-healing, administration, error-management, hot-code-upgrading, etc. on behalf of the developer. If you've tried to build these capabilities for real, I think you'll find OTP breathtaking. I would have liked even more examples.
While many of the examples are short, it is testament to the compact, expressive power of Erlang that significant examples are included without making the book feel like a pile of code. There's plenty of explanatory meat too.
Weaknesses? There are a few. I would have liked more string or text processing. More complete comparison with 'traditional web application architecture' because that's perceived as the basic 'bread and butter'. The function-reference appendix is inferior to the free, on-line documentation. I'd also recommend also buying the searchable PDF to speed things up when your working. Finally, the front cover 'zebra-crossing' isn't as cool as the 'pickaxe book' :-)
This book won't make you a great Erlang programmer, but it does feel like a massive leap in an important direction. Even if you never use Erlang, you could benefit from reading it. I found myself hacking pieces of code, experimenting with toy servers, while I was supposed to be watching TV. Beware, Erlang can become addictive stuff.
I apologise for the long review, but the book review listed here was too sparse to do the book justice.
Summary: Easy to read, practical, engaging, and sometimes inspirational. If you are interested in building Enterprise-class distributed software systems, get the book, download the open source software, hack the examples, and revel in the experience; simply: "jump in the water is lovely".
on 19 April 2009
A good introduction to Erlang, with worked examples. Reading style is fairly formal but quite readable, easy to get on with.
My one gripe with this book is that the most it states about race conditions is that you should write programs to not be sensitive to the order they receive messages from different processes, and if not, bugs can ensue. For such a significant problem area, and a paradigm that will be new to most people, that's not enough - some examples of what problems there are, how to solve them, and what patterns work well would have made the book twice as valuable. Similarly, the advice on how many processes is "Just enough, and not too much", which I'm sure is right, but really is longing for more to be said. (Hopefully a "More Erlang" book would cover these). Both topics receive 1-2 paragraphs.