Erlang coding standards and good practices

Well, there is this http://www.erlang.se/doc/programming_rules.shtml. It's pretty comprehensive.


I don't know of one. Which is more readable to you? This:

init([]) ->
   AChild = {'AName',{'AModule',start_link,[]},
         permanent,2000,worker,['AModule']},
   {ok,{{one_for_all,0,1}, [AChild]}}.

or this:

init([]) ->
   AChild = {
      'AName',
      {'AModule', start_link, []},
      permanent,
      2000,
      worker,
      ['AModule']
   },
   {
      ok, 
      {
         {one_for_all,0,1}, 
         [AChild]
      }
   }.

or this:

init([]) ->
   AChild = { 'AName'
            , {'AModule', start_link, []}
            , permanent
            , 2000
            , worker
            , ['AModule'] }
   { ok, 
      { {one_for_all,0,1}
      , [AChild] } }.

I like the last one, but consistency is most important. So I suggest defining a standard that works for you.


There is a tool called Elvis that can be used to enforce a coding style, but the default rules are those from Inaka (the creators) rather than defaults for the Erlang community as a whole.