[erlang-questions] how to break the problem. the erlang way?
Fri Jul 31 16:58:33 CEST 2009
Yes something like that, though I'm sure you would not need 5 processes.
Process tasks do not need to be so finely grained, but can be if you really
need the flexibility.
On Fri, Jul 31, 2009 at 4:47 PM, Ovidiu Deac <ovidiudeac@REDACTED> wrote:
> I'm doing some evaluation of erlang so I came with the following problem:
> "The application has to subscribe to a multicast address and receive
> binary packets. One packet per datagram. Each packet has a lenght, a
> sequence number and a number of messages inside. Packets have to be
> processed in their sequence number order. The messages have to be
> extracted from the packets and written in a file."
> I come with C++/Python experience and in OO approach I would have the
> following components:
> 1. A Receiver who connects to the multicast and receives the packets
> 2. An Orderer who's responsability is to order the packets by their
> sequence number and detect the missing ones.
> 3. An Unpacker who's responsability is to unpack the incomming packets
> and extract the messages.
> 4. A Decoder who does the deserialization of the messages
> 5. A Writer who puts the messages in the file.
> Now if I move all this to Erlang I would map the objects to processes.
> Instead of having objects with methods being called I have processes
> which receive messages. So the 5 components would run as separate
> processes. Each one does a little job and passes the result to the
> next one.
> Is this the Erlang way? Or is it just too much message passing overhead?
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
More information about the erlang-questions