Erlang! The language of concurrency, and much more. It’s the first actual functional language from the book, although not purely functional.
Erlang is acronym for Ericsson Language and was originally developed by Joe Armstrong in 1986. What started as finding a better way of writing control software for a telephone exchange, is now the foundation of many highly reliable systems like CouchDB and Facebook’s chat.
Bruce characterizes Erlang as Agent Smith, the artificial intelligence program in the Matrix. It has the ability to take any form and bend the rules of reality to be in many places at once. He was unavoidable.
Erlang is the second language in the book that is completely new to me (the other was Prolog). After a week of Prolog, Erlang isn’t as much of a shock. They both heavily use pattern matching (for the good) and their syntax is much alike. Although a big advantage in Erlang is the ability to use return values. It might be because Prolog was still fresh in my memory, but I had not much trouble with Erlang’s syntax.
The first exercises would be rather trivial with Erlang’s core libraries, but of course that would spoil the exercise. Therefore I didn’t use any of the core library functions and wrote any functions I needed, myself. This helped getting a better grip on the language.
On day 3 the exercises were all about concurrency. To explore the concurrency features introduced on day 3 I went a bit beyond the exercise of monitoring a translation process and restart it in case is dies. The doctor I wrote can monitor and restart any process, and I attached translation services for two languages.
Further exercises on day 3 were to set up two-way process monitoring, so that both processes are automatically restarted in case of failure. Erlang makes this pretty easy.
All in all I liked Erlang a lot. Once you get used to the syntax (which might take a little while, but again it is definitely simpler than Prolog) you have access to an amazingly powerful language. I believe that the most power in Erlang comes from its unique approach to concurrency. It uses very lightweight processes to handle messages. It’s extremely easy to monitor processes and restart them might they fail. This complements Erlang’s let it fail strategy, which makes error handling so much easier.
What’s more is that the Open Telecom Platform (OTP) provides standard ways for creating and monitoring processes. With only a few lines of code you build reliable concurrent processes. Erlang provides what many other languages cannot: scalable concurrency and reliability.
Compare that to Java’s heavy threading model! Java might be the enterprise technology of today, but Erlang has industrial strength ready for adoption.