about this book

This book is focused on getting real, stable, versioned, and maintainable software out into the world. It’s less theoretical, and more hands-on practical. We (the authors) have put many systems into production over the years, and in this book we distill that knowledge for use in real software development. Our focus is not just the Erlang programming language by itself—other books out there are more suited as language tutorials. This book is about the practice of writing Erlang code for production.

Because this book is aimed at allowing individual programmers or teams of programmers across a company to write effective code, it covers Erlang/OTP right from the start, not just Erlang the language. Erlang by itself offers the potential for powerful applications to be created, but it’s with OTP that it realizes that potential. OTP is simultaneously a framework, a set of libraries, and a methodology for structuring applications; it’s really a language extension. To learn Erlang for the real world means learning Erlang/OTP.

This book illustrates how to use Erlang/OTP in practice, through carefully chosen realistic examples. By implementing these examples for yourself, you’ll come to understand how to build solid, versioned, production-ready code that is ready to utilize every cycle of that 32-core machine you have sitting in your server rack!

Roadmap

The book is divided into three parts. Part 1 is aimed at getting you past programming in pure Erlang, introducing the basics of OTP:

Part 2 of the book gets down to business, giving you a real programming task and adding more advanced OTP features to the code as you move along:

Part 3 of the book is about making your code work as part of a greater whole, integrating it with other systems and users, and optimizing it as the load increases:

It’s worth noting that we don’t cover the gen_fsm behaviour in this book. This is intentional; gen_fsm is a behaviour seldom used in practice. The book covers the most important of the OTP behaviours in great detail, and from this you’ll come to understand behaviours well enough that learning about gen_fsm from the official documentation on your own will be easy. Among other things, it can be useful for parsing binary protocols; but a plain gen_server and the judicious use of pattern matching is almost always more appropriate and, in particular, more flexible. If you were looking forward to learning about gen_fsm, we’re sorry, but overall you’re better served by the main behaviours.

Source code

All source code in listings or in text is in a fixed-width font like this to separate it from ordinary text. Code annotations accompany many of the listings, highlighting important concepts. In some cases, numbered bullets link to explanations that follow the listing.

The code for this book is available at http://github.com/erlware/Erlang-and-OTP-in-Action-Source (or go to github.com and search for “Erlang and OTP in Action”). It is also available from the publisher’s website at www.manning.com/ErlangandOTP-inAction.

Author Online

The purchase of Erlang and OTP in Action includes free access to a private forum run by Manning Publications where you can make comments about the book, ask technical questions, and receive help from the authors and other users. You can access and subscribe to the forum at http://www.manning.com/ErlangandOTPinAction. This page provides information on how to get on the forum once you’re registered, what kind of help is available, and the rules of conduct in the forum.

Manning’s commitment to our readers is to provide a venue where a meaningful dialogue between individual readers and between readers and the authors can take place. It isn’t a commitment to any specific amount of participation on the part of the authors, whose contributions to the book’s forum remains voluntary (and unpaid). We suggest you try asking the authors some challenging questions, lest their interest stray!

The Author Online forum and the archives of previous discussions will be accessible from the publisher’s website as long as the book is in print.

About the authors

MARTIN J. LOGAN has been heavily involved with the Erlang community since 1999. His great interest in distributed systems and service-based design has made him a constant presence in the community. He has given many talks on the topic, in the U.S. and Canada as well as in Europe, and he is one of the people behind the Chicago ErlangCamp conference. Martin has implemented many complex systems using Erlang in the telecom space, including one of the first call-detail record-collection systems for the SIP protocol; but more recently, he has focused on large-scale e-commerce backing systems. Currently, Martin brings his expertise to Orbitz Worldwide, one of the largest online travel companies in the world. Martin has also taken on a leadership role with Erlware, where he is a core developer and the primary author of the Faxien package-management system. He currently lives in Chicago with his wife Veronica.

ERIC MERRITT is a software engineer who specializes in concurrent languages and distributed systems. For the last nine years, he has been coding Erlang and has also been heavily involved in the Erlang community. Eric has been involved in both professional and open source development for the last ten years. He started his career developing in C and Java on IBM mainframe and midrange hardware. He also provided training and consulting in object-oriented principles and concepts. However, his interest in languages, concurrency, and distributed systems soon drove him to more interesting and challenging work at companies such as Amazon.com. Currently, Eric is a core developer for the Erlware family of open source products and he is the primary author of the Sinan build system. His day job involves hacking Erlang for eCD Market, LLC.

RICHARD CARLSSON has been deeply involved with Erlang since the mid-nineties. He was one of the original members of the High-Performance Erlang group at Uppsala University, and has contributed to many parts of the standard libraries, the Erlang compiler, runtime system, and the language itself. Among other things, he is the author of Erlang’s EDoc documentation system and the EUnit unit testing framework. He is currently working for Klarna, one of Sweden’s fastest growing companies, which provides payment solutions, all based on Erlang, in Scandinavia, Germany, and the Netherlands.

About the cover illustration

The illustration on the cover of Erlang and OTP in Action bears the caption “An Artvinian,” a resident of a region called Artvin in northeast Turkey. The image is taken from a collection of costumes of the Ottoman Empire published on January 1, 1802, by William Miller of Old Bond Street, London. The title page is missing from the collection and we have been unable to track it down to date. The book’s table of contents identifies the figures in both English and French, and each illustration also bears the names of two artists who worked on it, both of whom would no doubt be surprised to find their art gracing the front cover of a computer programming book...two hundred years later.

The collection was purchased by a Manning editor at an antiquarian flea market in the “Garage” on West 26th Street in Manhattan. The seller was an American based in Ankara, Turkey, and the transaction took place just as he was packing up his stand for the day. The Manning editor did not have on his person the substantial amount of cash that was required for the purchase and a credit card and check were both politely turned down. With the seller flying back to Ankara that evening the situation was getting hopeless. What was the solution? It turned out to be nothing more than an old-fashioned verbal agreement sealed with a handshake. The seller simply proposed that the money be transferred to him by wire and the editor walked out with the bank information on a piece of paper and the portfolio of images under his arm. Needless to say, we transferred the funds the next day, and we remain grateful and impressed by this unknown person’s trust in one of us. It recalls something that might have happened a long time ago.

The pictures from the Ottoman collection, like the other illustrations that appear on our covers, bring to life the richness and variety of dress customs of two centuries ago. They recall the sense of isolation and distance of that period—and of every other historic period except our own hyperkinetic present. Dress codes have changed since then and the diversity by region, so rich at the time, has faded away. It is now often hard to tell the inhabitant of one continent from another. Perhaps, trying to view it optimistically, we have traded a cultural and visual diversity for a more varied personal life. Or a more varied and interesting intellectual and technical life.

We at Manning celebrate the inventiveness, the initiative, and, yes, the fun of the computer business with book covers based on the rich diversity of regional life of two centuries ago‚ brought back to life by the pictures from this collection.