[erlang-questions] Best practices in gen_fsm usage

Max Lapshin max.lapshin@REDACTED
Wed Dec 7 10:40:03 CET 2011


On Wed, Dec 7, 2011 at 12:27 PM, Vance Shipley <vances@REDACTED> wrote:
> Sure, go ahead and do that.  The gen_fsm behaviour is a tool to
> help you implement communicating finite state machines which is

gen_fsm is not about finite state machines. Please, read definition of
this term before repeating these words.
It is mathematical term, that has some specific properties, that has
nothing to do with gen_fsm api.

> a common design pattern encountered in the real world.  If you
> are working with FSMs but have no understanding of that you will
> simply have a harder time conceptualizing the problem and it's
> solutions.  On the other hand if you do understand the theory you
> can then make an informed decision on an implementation.
>
> The fact is that if you tried to implement an FSM decribed in 50
> pages of SDL you'd get lost pretty soon using a gen_server.  Or
> not ... it's just syntactic sugar.
>

It is exactly what Treskin was talking about. Show example of code,
which is better built on gen_fsm, than on gen_server.



More information about the erlang-questions mailing list