Behaviours are like patterns which makes easier to understand the erlang code to every Erlang programmer. The idea behind the Behaviour is to divide the Erlang code for a process in a generic part (means: a behaviour module) and a callback module.
There are different types of behaviours in Erlang, some of them are as follows:
1. gen_server: gen_server allows to send and receive sync and async messages, start and stop processes and allows to code change.
2. gen_event: gen_event is used for implementing event handling functionality and the OTP event handling model consists of a generic event manager process with an arbitrary number of event handlers that are added and deleted dynamically.
3. supervisor: supervisor is used for monitoring processes and we can implement a good shutdown and restart strategy around it.
4. gen_fsm: gen_fsm allows changes whether there are too many states involve in an application.
5. gen_mod: gen_mod provides the facility to extend the ejabberd modules with the xmpp server have to implement gen_mod behaviour. And also it has start/2 and stop/1 functions that allows us to intergrate the custom functions of our module.
Liked By
Write Answer
Types of module behaviours in Erlang?
Join MindStick Community
You have need login or register for voting of answers or question.
Tarun Kumar
05-Mar-2016