OTP
OTP is a domain-independent set of frameworks, principles, and patterns that guide and support the structure, design, implementation, and deployment of Erlang systems. Using OTP in your projects will help you avoid accidental complexity: things that are difficult because you picked inadequate tools. (Cesarini and Vinoski 2016, 20)
Behaviors
Behaviours are a way of formalizing common patterns in process-oriented programming. For example, the concept of a server is general and includes a large portion of all processes you’ll ever need to write. All those processes have a lot in common—in particular, whether they should be made to follow OTP conventions for supervision and other things. (…)
Instead, an OTP behaviour takes such a recurring pattern and divides it into two halves: the generic part and the application-specific implementation part. These communicate via a simple, well-defined interface. (Logan, Merritt, and Carlsson 2010, 97)
Components of a Behaviour
- The interface
- The implementation
- The container
Kinds
- OTP Application: Implements the
application
behaviours, which is a way to package related modules in Erlang. - genserver
- supervisor
gen_statem
: State Machinesgen_fsm
: Finite State Machine- genevent