[erlang-questions] Code review request

Andre Nathan andre@REDACTED
Mon Sep 10 15:29:33 CEST 2007


This is my first post to the list. I hope it's ok to ask this here.

I just wrote my first almost-non-trivial erlang program :) It creates a
distributed graph (one node per process), and a simple flooding
algorithm with feedback allows a node (triggered by an external message
sent to that node) to count the number of nodes in the graph.

The main code is in the "node" module, pasted here: 


Since this is the first thing I write in erlang that isn't a tutorial
example, it probably has parts that could be better written, so before
implementing more stuff, it would be cool to get some advice or
suggestions on how to improve this code.

For example, I'm using a "state" record to avoid lots of parameter
passing, but maybe there's a better solution. Also, I would like to move
the code for this algorithm to a separate module for better
organization, since the "node" code will become cluttered when I add
more functionality.

Is there anything there that could be rewritten in a more erlangish way?

Thanks in advance,

More information about the erlang-questions mailing list