[erlang-questions] Design methodology going from Object oriented to functional programming?

Alexander Lamb <>
Mon Oct 22 14:47:44 CEST 2007


Hello list,

I am trying to understand what is the design process (intellectual,  
that is) when building a program in Erlang.

Indeed, in the object oriented world, I would start by finding what  
my classes might be and the relationship between them. Gradually I  
would add functions (class or instance methods) to the classes in  
order to provide solid foundations on top of which I can write an  
application.

For example, I could have PERSON, PROFILE, ROLE, FEATURE, etc... and  
decide a PROFILE is a collection of FEATURES. A PERSON can have 0 or  
many ROLES. A ROLE is a PROFILE on a given area (a department for  
example) for a given time. I would then add functions such as "give  
all the active roles for the user" or "what features give that  
profile" or "does the user have a given feature for that department".
I admit it is more complexe than that, but you get the idea.

Obviously, this doesn't seem to be the way to go with Erlang.  
Intuitively, I would start making a list of all the functions which  
will allow me to interract with my application. In that case I could  
have "give me all users with an active role on that department",  
etc... Then by implementing those high level functions I would split  
them into pieces by calling smaller simpler functions. The underlying  
data structure will "just follow" or "appear" naturally.

Hence: object oriented design is "data structure and relationships  
first, functions second" and functional design is "functions first,  
data structure second".

Am I being over simplistic here. Are there some guidelines as to how  
one can approach a problem when creating a new program? Especially  
programs which deal with persistent data, not protocole analysers or  
socket servers!

Thanks,

Alex
--
Alexander Lamb
Founding Associate
RODANOTECH Sàrl

4 ch. de la Tour de Champel
1206 Geneva
Switzerland

Tel:  022 347 77 37
Fax: 022 347 77 38

http://www.rodanotech.ch



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20071022/e7dd1c31/attachment.html>


More information about the erlang-questions mailing list