[erlang-questions] Using processes to implement business logic
Jesper Louis Andersen
Sat Jan 31 16:23:05 CET 2015
On Fri, Jan 30, 2015 at 11:52 AM, Camille Troillard <lists@REDACTED> wrote:
> It looks like, in the context of our problem, we should have more
> advantages implementing our domain model using processes rather than simple
> Erlang records. It also appears that processes will act as a nice cache
> layer in front of the persistent storage.
In the words of the Subject/Object dichotomy: do you want your business
entities to "act" or be "acted upon" ?
If the former is true, then make them into processes. This is often the
case if your entities are "alive" and needs to query databases, have
timeouts, needs to manage persistence and so on. Or if the processing of an
entity is complex with many different advanced code paths.
If the latter is true, then make them into records. This is usually good if
your data can be batch-processed and is just "dead" data, where other
systems are using that data to work. This often leads to a pipeline
processing chain where workers (subjects) operate on the entities. This is
also the only viable model in many programming languages.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions