Erlang has come a long way since it began its odd life in the 1980s as a programming language for telephone switching systems, specifically Swedish-made, Ericsson telephone switching systems.
Today, the language and its Open Telecom Platform libraries are gaining new converts among serious practitioners of functional programming. Many of them likewise are drawn to the built-in support for concurrency, distribution and fault tolerance.
“The broad shift from single computers to networked and distributed systems of multiprocessor-based computing gives the Erlang environment a tremendous advantage over practically every other environment out there,” author Simon St. Laurent contends. “More and more of the computing world is starting to face exactly the challenges that Erlang was built to address.” Yet, as he concedes in his preface, “Erlang has long been a mysterious dark corner of the programming universe, visited mostly by developers who need extreme reliability or scalability and people who want to stretch their brains.”
Brain-stretching indeed is one reason why Erlang has stayed in that dark corner for more than two decades.
The language’s learning curve, St. Laurent notes, “starts gently for a while, then it gets much steeper as you realize the discipline involved, and then goes nearly vertical for a little while as you try to figure out how that discipline affects getting work done—and then it’s suddenly calm and peaceful with a gentle grade for a long time as you reapply what you’ve learned in different contexts.”
In a world where everything seemingly must be done in a hurry, you won’t learn Erlang in a hurry. But the payoff for learning it can be rewarding. Erlang, it seems, now is on a roll and experiencing growing demand. The language has been showing up in many different places, from Facebook to CouchDB to the Costa Rican Institute of Technology, to name just a few. Numerous package managers, such as Debian, MacPorts, and Ubuntu, also include a version of Erlang in their default installation.
I run Windows machines, and getting Erlang onto them has proved pleasingly easy. Indeed, Windows users apparently have some of the easiest times getting started with Erlang. Just go to http://erlang.org/download.html and click on the correct link – 32-bit or 64-bit – for your PC.
The book’s code samples can be downloaded from a link provided in the book. And it’s easy to work with the Erlang shell, its command-line interface. The newest version now provides numbered lines.
But, if you’ve worked with other programming languages, Erlang’s syntax likely will seem awkward and strange for a while.
“Punctuation is different and capitalization matters,” the author emphasizes. “Periods even get used as conclusions rather than connectors!”
To display the current working directory in the shell, for instance, you type pwd(). And do not forget to include the period.
To move up a directory, you type cd(“..”). And do not forget to include both the quotation marks and the concluding period.
Indeed, almost everything you enter in Erlang seemingly must end with a period.
Also: “Forget classes, forget variables that change values—even forget the conventions of variable assignment,” the author cautions. “Instead, you’re going to have to think about pattern matching, message passing, and establishing pathways for data rather than telling it where to go.”
Introducing Erlang takes a slow and gentle but effective approach to learning this powerful and difficult language. Simon St. Laurent spends a lot of time trying to help readers “get comfortable in the sunny meadows at the bottom of the learning curve.” Still, his well-written book effectively and efficiently meets its stated goal of helping you “learn to write simple Erlang programs.” It likewise shows and explains how to get started working with the OTP, the Open Telecom Platform’s libraries.
The book and its numerous code examples offer a solid grounding in the basics that you can then use to “understand why Erlang makes it easier to build resilient programs that can scale up or down with ease.” And, if you decide to continue learning, Simon St. Laurent’s new book can make it easier for you to move on to the really brain-stretching, and shadowy, inner workings of Erlang.
– Si Dunn