Erlang OTP In Action
Buy it now
One Minute Bottom Line
|By far the best way to learn a new programming language is to write something in it - preferably something useful. "Erlang and OTP in Action" encourages this practice by providing extensive examples, samples and exercises which speed understanding of what would otherwise be potentially difficult concepts to understand. The emphasis on OTP, the Erlang toolset, and integration with other languages via native libraries & REST services follows the Erlang philosophy itself in that the language is (at least once you get used to it) relatively uncomplicated while the tools & libraries are the big levers for moving mountains. This book covers everything you need to move beyond an academic interest to having a working knowledge of the language, libraries & tools needed for production application development.|
ReviewRecent emphasis on multi-core processors and concurrent programming has seen the use of functional languages become much more widespread outside of the academic community. Older languages, such as Haskell, are seeing increased use in commercial applications, and newer languages such as Clojure & F# - targeted at the JVM and CLR respectively - are rapidly gaining ground. Hidden in the background all this time, and yet now becoming one of the big players in the "next generation" of programming languages, is Erlang. But Erlang is not new - it was developed over 10 years ago at Ericsson, is used extensively in the company's telecommunications products and has been Open Source for most of that time. The OTP (initially Open Telecom Platform, now much more) is a set of libraries which form the base for rapid development of highly reliable server applications. In fact, I would go so far as to say that if you want to develop a scalable, efficient and extremely reliable (nine 9's is one quoted figure) server application then Erlang has to be on the table as a language and runtime of choice.
The downside is that, like many other functional languages, if you're moving from the imperative/object-oriented world (Java, C#, Ruby, Python, etc) then some of the concepts in Erlang will take time and a lot of head-smacking to absorb. The good news is that once you grasp them, developing in Erlang becomes so easy you wonder why every other language doesn't have the same features.
To help you learn, a good book is essential and "Erlang and OTP in Action" is just that. As with the other titles in the "In Action" series from Manning, the emphasis is on practical application of the language and it's libraries.
After an introduction to the Erlang runtime - how it handles distribution and concurrency are vital to understanding the language and developing applications - the language essentials are covered. Erlang assists by having an interactive shell available and it's used extensively throughout to experiment and demonstrate the language features. The usual concepts such as basic syntax, data types, variables, functions, control flow and exception handling are pretty much the same as learning any new language. List comprehensions, bit syntax, pattern matching and recursion introduce some of the elements which make Erlang truly excel, and all are thoughtfully described with examples to help the imperative programmer update to the functional world.
As early as Chapter 3, we have all we need to start building a full-blown Erlang application: a TCP-based RPC service. Here we start to see the practical application of Erlang's modular structure and some of the basic OTP "behaviors" (runtime process structure).
But there's more. Erlang/OTP has an entire structure of process management and fault tolerance, reflected in the OTP libraries. The basic structure of an Erlang/OTP application - directory & file layout, configuration & metadata, and of course the code itself, plus a more detailed view of the use of supervisor processes has a dedicated chapter. Following on from there is an overview of the tools available to inspect and/or manage an Erlang runtime & application. Again, a detailed example - a cache system - is used to demonstrate the recently-covered concepts.
Logging, event handling and distributed Erlang/OTP are covered before turning once again to the cache system example and converting that to a distributed cache. As part of that process, the distributed Erlang database, Mnesia, is introduced and used as the backing store for the cache. Cache application development closes with a walk through release build & installation process. Later chapters cover a variety of remaining topics. Integration with other languages & systems, primarily Java with the JInterface library although generic language/system integration using drivers is also covered. An interesting twist, and a great example, is the integration of the HBase Java database with the cache application by writing a JInterface integration layer.
For those working on production systems rather than simply experimenting, profiling and optimization tools & techniques are explored, but with small contrived examples where it would have been nice to see the earlier example applications profiled instead. Strangely, while the Faxien package manager and Sinan build system are covered in some detail - including a worked example of an application development cycle - it's only in an appendix when they easily deserved a proper chapter of their own.
In general, this is a worthy addition to the growing ranks of Erlang books with more of an emphasis on the process and tools of getting an application into production than most others. I found working through the examples - particularly creating, building and releasing an application, then using various tools to monitor it - gave me more confidence in proposing Erlang as a production-ready solution.
Remember, if you're a member of DZone you get a 40% discount on books and ebooks ordered on Manning.com. The promo code is dzone40. Go stock up now!
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)