[erlang-questions] Best practices in gen_fsm usage
Wed Dec 7 10:58:00 CET 2011
On 7 Dec 2011, at 10:40, Max Lapshin wrote:
> 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.
This is a fairly narrow view. Finite State Machine is the commonly accepted name for the kind of model gen_fsm implements, and also what the 'fsm' part of the name stands for.
If you read the Wikipedia article on FSMs, you will find references to both UML and SDL state machines (http://en.wikipedia.org/wiki/Finite-state_machine#SDL_state_machines)
(SDL is now a subset of UML).
You can also read up on Finite State Machines in SDL here:
(The examples described there can be mapped 1:1 to gen_fsm).
>> 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.
> erlang-questions mailing list
More information about the erlang-questions