[erlang-questions] Design pattern: single responsibility
Richard A. O'Keefe
Fri Mar 6 00:55:35 CET 2015
We've had a thread about the use or otherwise of design patterns in Erlang.
I've also had some mail that had me thinking about this.
One idea which already has a name is "Single Responsibility".
The Wikipedia article http://en.wikipedia.org/wiki/Single_responsibility_principle
says it's about classes, but really it's nothing but cohesiveness
by another name.
In the context of Erlang,
the idea is that each process should do one job.
Suppose a process has two jobs, A and B.
And something about working on A makes it crash.
Now nobody is doing job B.
If we have two processes, they can execute on
If jobs A and B are coupled somehow, there will have
to be communication between the processes working on
them that there wouldn't be in a single process.
Separating logging from working.
More information about the erlang-questions