Erlang Programming/Behaviors
Behaviors
editIn Erlang, a behavior is a design pattern implemented in a module/library. It provides functionality in a fashion similar to inheritance in object-oriented programming or interfaces in Java. A number of callback functions must be defined for each behavior to work.
Examples of behaviors are:
- client-server
- event-handler
- gen-server :gen_server
- hot-standby
- keep-me-alive
- supervision-tree
- upgrade-handler
- worker-supervisor
A behavior can be activated with the following code (note: you can use "behavior" instead, if you feel American):
-behaviour(gen_server).