Behaviours

Francesco Cesarini <>
Mon Sep 9 00:53:23 CEST 2002


Lots of valid suggestions on behaviors came by in the past posts. To 
them, I would like to abstract a little and define "OTP".

OTP consists of three things.

1 Erlang
2 A set of applications (or components)
3 A set of design principles.

These design principles allow you to build an application which exhibit 
the exact same behavior as the applications which are part of the 
release. In an Erlang system, you create your applications, package them 
together with OTP's applications (So that the underlying system does not 
differentiate between them), and then use the SASL application to "glue 
and start them together".

As Lennart said, part of these design principles involves abstracting 
away as much of the common code as possible, leaving only the specific 
code to be implemented by the designers. All client - servers for 
example follow the same structure. You start them, you stop them, you 
send synchronous and asynchronous messages to them. By abstracting away 
all of this common functionality into behavior modules, you can

A. Allow all your processes to display a uniform interface to what ever 
application is controlling them.
B. Allow your processes to follow a certain protocol (Such as when 
applying a software upgrade)
C. Centrally add/control features and support such as debug printouts, 
stat monitoring, etc.
D. Allow you to control them uniformly (ex. Start/stop as a whole)
E. Allow a component based terminology

When ever processes follow the same patterns, we say they share the same 
behavior. Based on this and all the other emails, I would suggest you 
reread the design principle document, as the message it is trying to 
portray might be a little clearer.

Give us a shout if it isn't..

Francesco
--
http://www.erlang-consulting.com

Alex Peake wrote:

>Thank you Francesco.
>
>I guess the answer is that there is nothing "of a tutorial nature".
>
>I was looking for more of:
>
>What is a behaviour? When do you need one? How do you build one?
>
>(I saw a quote from Joe Armstrong something of the nature that -- in Erlang you do not need objects
>because you have behaviours -- so I wanted to explore what this meant)
>
>Alex
>
>>-----Original Message-----
>>From: Francesco Cesarini [mailto:]
>>Sent: Sunday, September 08, 2002 6:02 AM
>>To: Alex Peake
>>Cc: 
>>Subject: Re: Behaviours
>>
>>
>>Hi Alex,
>>
>>OTP behaviors are covered in detail in the Design Principles
>>documentation at
>>http://www.erlang.org/doc/r8b/doc/design_principles/part_frame.html It
>>also gives a few good examples. You can complement this with the manual
>>pages for the different behavior modules. Lastly, you can find tons of
>>examples of usage of behaviors in the contributions section of the open
>>directory.
>>
>>Good Luck,
>>Francesco
>>--
>>http://www.erlang-consulting.com
>>
>>Alex Peake wrote:
>>
>>>Is there, somewhere, a more tutorial description of how to create behaviours?
>>>
>>>Alex
>>>
>>>
>>>
>>
>>
>
>
>
>





More information about the erlang-questions mailing list