Join us on:

T27. Erlang/OTP Design Patterns

Francesco Cesarini, ErlangTraining and Consulting

Maybe you've read Joe's book and understand the basics of Erlang. Perhaps you've done a bit of coding and feel comfortable with the concurrency model. What do you need to get you to the next level? Erlang is just a programming language. To build highly scalable, fault tolerant systems with requirements on high availability, you need more than just a programming language. This is where the OTP middleware comes in. OTP consists of tools, reusable components and libraries, and design patterns. The design patterns describe how to structure and deploy production systems. Many tools and libraries provided with Erlang are dependent on these design patterns for them to work correctly.

This goal of tutorial is a hands-on introduction to the theory and concepts behind these design patterns, explaining how they are used to build industrial grade systems. These design patterns, also known as OTP behaviours, include client servers, event handlers, finite state machines, supervisors and applications. We will introduce the concept of behaviours and explain the rationale behind the gen_server, also known as the client-server behaviour.

In order to get the most out of this tutorial, you must have a good grasp on Erlang syntax, semantics and understand its concurrency model. If you have not read about or used Erlang, attend the Practical Erlang Programming tutorial on Monday to prepare for this tutorial.


The contents of the tutorial will include:

Introduction – 30 minutes

This section introduces the need and advantages of using middleware in the development of massively concurrent, distributed, fault tolerant real time systems in Erlang. It looks at Erlang's evolution, and how it helped form OTP.

Behaviours – 45 minutes

Erlang processes display similar properties. In the Open Telecom Platforms, these properties have been abstracted in a group of generic library modules, also called OTP behaviours. This section introduces the concept of behaviours, and through examples of abstraction, shows their need and advantages.

Generic Servers + Exercises – 1 hour 45 minutes

Generic servers implement the Client-Server behaviours in OTP. This section introduces the most commonly used behaviour in Erlang based applications, the gen_server worker process.

Other Behaviours and release files – 30 minutes

This section provides a high level overview of the other OTP worker behaviours,including finite state machines, event handlers, supervisors and applications. It concludes with how Erlang applications are coupled together in a release and started as a whole.


This will be a hands on tutorial. Make sure you come with your laptop having installed Erlang and your favourite editor.

Audience: Practitioners
Please email any questions to . This e-mail address is being protected from spambots. You need JavaScript enabled to view it