Erlang by Example
Erlang by Example
Course Contents
Erlang By Example is a five day introductory course aimed at software engineers. Its objectives are to give
participants the knowledge to read, write and structure Erlang programs, providing all prerequisites to attend
the Advanced Erlang/OTP course. The course contains all the Erlang basics such as sequential and
concurrent programming, along side error handling and the latest language extensions. The Erlang
development environment is presented, with a special emphasis on the Erlang mode for Emacs alongside
the major debugging tools. Good and bad programming practices are discussed, as are tools used to profile
the system. OTP design principles and concepts are sneaked into the material as well as the exercises.
All material in these pages, including text, layout, presentation, logos, icons, photos, and all other
artwork is the Intellectual Property of Erlang Training & Consulting Ltd, unless otherwise stated, and
subject to Erlang Training & Consulting Ltd copyright. No commercial use of any material is authorised
without the express permission of Erlang Training & Consulting Ltd. Information contained in, or derived
from these pages must not be used for development, production, marketing or any other act, which
infringes copyright. This document is for informational purposes only. Erlang Training & Consulting Ltd
makes no warranties, expressed or implied, in this document.
Basic Erlang
This section deals with Erlang data types and pattern matching. Functions, modules, and BIFs are
discussed. Before the exercises, the Erlang shell, useful shell commands as well as Emacs and its Erlang
mode are introduced.
Sequential Programming
The Sequential Programming section comprehends conditional evaluations, guards and scope of variables. It
then introduces recursion, with a special emphasis on different recursive patterns, tail recursion, and space
saving optimizations. Before the exercises, libraries and their manual pages, possible run time errors and the
debugger are demonstrated.
Concurrent Programming
This section describes the creation of processes and their life span. It looks at sending and receiving
messages, selective reception, and passing data in the messages. It continues with the various uses of time
outs and registering processes, and terminates by showing the generic process code structure. Before the
exercises, a demonstration of the Process Manager tool is given.
Code Updating
The section introduces software upgrade during run time. The error handler, the code server, and code
search paths are covered, as is the .erlang file.
ETS tables
An introduction to the Erlang Term Storage is given, together with its different table options. Examples on
when to use and not to use ETS tables are covered. A demonstration of the table visualizer is provided.
Distributed Programming
An introduction to the requirements of distributed systems is given, and how Erlang is able to fill these
requirements. The distribution syntax and semantics are covered, followed by the BIFs and the net kernel.
Advanced Constructs
List comprehensions and their usage are explained. References are discussed. This is followed by Binaries,
and the Bit syntax, where pattern matching can be applied directly to incoming structures. Lastly, bit wise
and logical operators are described. This section also covers Macros, with examples on how they can be
used for debugging purposes.