A coding idiom is a solution to a commonly occurring programming problem. In a sense all recipes are idioms, but we use the term here for those recipes that apply to many different tasks. In Erlang many patterns, such as object oriented programming, become idioms as we can express these patterns directly in code using functions and macros.
A seminal work in Object Oriented Programming is the so-called "Gang of Four" book, Design Patterns: Elements of Reusable Object-Oriented Software. In the late 1990's, Peter Norvig argued that 16 of the 23 patterns in the Design Patterns book are simplified or eliminated in dynamic languages, such as Lisp or Erlang.
Hopefully, with the aid of the recipes in this section, you will soon be building robust, efficient, and understandable modules in Erlang.
Erlang programs are typically structured and built quite differently than many other languages. The major differences can be summarized in a few bullet points, which I here link to important papers exploring these ideas in more depth.
- Let It Fail -- The design of reliable systems, considering that the language implementations and runtimes are typically incorrect themselves, requires a new way of approaching software design.
- Everything Is An Erlang Process -- Model the natural parts of a problem as independent, communicating processes. In short, "Think Massively Parallel".
- Trust No One -- Erlang processes share no data, and only interact by exchanging Erlang messages.