ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> boost
boost
[boost] Re: Re: [prereview request][fsm]
by Andreas Huber other posts by this author
May 29 2004 11:19AM messages near this date
[boost] Re: [fsm] Why exit actions must not fail | [boost] Re: [prereview request][fsm]
Iain K. Hanson wrote:
>  What UML requires is not necessarily what is good for a generic FSM
>  framework. The UML model is IMHO over complex and probably broken.

Yes, it is indeed broken (there is at least one contradiction in it).
Whether it is overly complex or not depends on your application, i.e. how
much abstraction you need/want to employ to implement the problem at hand. I
have found that most of what is in there *can* be quite helpful.

>  An example is entry and exit actions for states. It is some what
>  oxymoronic that a single state should actually consist of three
>  sub-states because
>  of entry and exit actions. The idea that they must be paired is
>  particularly strange

Well, nobody forces you to pair them. My exit actions often don't do the
exact opposite of my entry actions (e.g. see the StopWatch example).
Sometimes I don't implement an exit action even if there is an entry action
and vice versa.

>  as one of the most common uses of the concept in
>  the networl
>  protocol work that I am familar with is prior to entering the idle
>  stae
>  some initialisation work is necessary and prior to re-entering an idle
>  state from an exit event we want to do some clean-up.
> 
>  This whole
>  concept
>  is much better modeled *IMHO* by transitory states. These have the
>  advantage that they do not have to be paired

You don't provide enough information for me to judge, but I agree that some
stuff can only be implemented satisfactorily with transition actions
(boost::fsm has them).

>  and they allow
>  same/self-transition
>  to be a no-op which is a very common requirement.

If you don't define entry/exit actions for a state without data members then
a self-transition is essentially a no-op. If this doesn't convince you (e.g.
because the state is still destructed and constructed once), you can
implement this with an in-state reaction, which is a true no-op.

>  Classical FSM's are a mapping from state/event pairs to behaviour and
>  transitions. The Idea that a state should maintain its own data and
>  thereby become stateful also seems to be bad modeling and against the
>  KISS principle.

Again, this depends on your application. You can find my arguments in the
rationale (State-local storage, Speed versus Scalability tradeoffs). If this
doesn't convince you then boost::fsm is not for you. I can't provide for
everyone and I wouldn't be suprised to find more than one fsm framework in
boost in say 5 years from now.

>  There are two other approaches to FSM's that do not apear to be
>  discussed in the rationale; Herb Sutter, in an article hints at using
>  boost::function
>  for FSM's and the GOF state pattern tals of using singleton, flyweight
>  states

Both of these approaches fail to meet so many of my requirements that I
decided not to discuss them.

>  which are re-enterant and therefore offer exelent MT performance.

As I argue in the rationale, if you have FSMs residing in threads then the
thread switching and locking overhead is typically much larger than the
overhead introduced by boost::fsm. I measured on Windows and other OSes
might be better in this regard but I still believe that the general rule
applies.

Regards,

Andreas


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thread:
Andreas Huber
Andreas Huber
Andreas Huber
Darryl Green
Darryl Green
Darryl Green
Darryl Green
Andreas Huber
E. Gladyshev
Andreas Huber
Andreas Huber
E. Gladyshev
E. Gladyshev
Darryl Green
Andreas Huber
Johan Nilsson
Darryl Green
Andreas Huber
Andreas Huber
Rob Stewart
Andreas Huber
Rob Stewart
Johan Nilsson
Andreas Huber
Andreas Huber
Johan Nilsson
Johan Nilsson
Andreas Huber
Andreas Huber
Andreas Huber
Darryl Green
David Abrahams
Andreas Huber
Andreas Huber
Rob Stewart
Andreas Huber
Andreas Huber
Andreas Huber
Andreas Huber
David Abrahams
David Abrahams
David Abrahams
Andreas Huber
Andreas Huber
Darryl Green
David Bergman
David Abrahams
David Abrahams
David Abrahams
Andreas Huber
Andreas Huber
David Abrahams
Andreas Huber
Andreas Huber
Andreas Huber
Andreas Huber
Darryl Green
Andreas Huber
Robert Bell
David Abrahams
E. Gladyshev
Johan Nilsson
Jeff Flinn
Johan Nilsson
Andreas Huber
Jeff Flinn
E. Gladyshev
Andreas Huber
Andreas Huber
Iain K. Hanson
Robert Bell
David Abrahams
E. Gladyshev
Andreas Huber
Andreas Huber
David B. Held
Andreas Huber
Johan Nilsson
Johan Nilsson
Peter Dimov
Johan Nilsson
Topher Cooper
Johan Nilsson
Johan Nilsson
Andreas Huber
Robert Bell
Andreas Huber
Andreas Huber
Andreas Huber
E. Gladyshev
Andreas Huber
Andreas Huber
E. Gladyshev
E. Gladyshev
Andreas Huber
Andreas Huber
E. Gladyshev
David Abrahams
Andreas Huber
E. Gladyshev
E. Gladyshev
Rob Stewart
E. Gladyshev
E. Gladyshev
Rob Stewart
E. Gladyshev
Rob Stewart
E. Gladyshev
Andreas Huber
Andreas Huber
E. Gladyshev
Marshall Clow
Marshall Clow
E. Gladyshev
David Abrahams
Darryl Green
E. Gladyshev
Andreas Huber
Andreas Huber
Robert Bell
Darryl Green
Pavel Vozenilek
David Abrahams
Andreas Huber
David Abrahams
Gregory Colvin
Pavel Vozenilek
Andreas Huber
Robert Bell
Andreas Huber
Johan Nilsson
Andreas Huber
Andreas Huber
Johan Nilsson
Johan Nilsson
Rob Stewart
Johan Nilsson
Andreas Huber
Andreas Huber
David Abrahams
Andreas Huber
Andreas Huber
David Abrahams
Andreas Huber
Andreas Huber
Johan Nilsson
Rob Stewart
Kwee Heong Tan
David Abrahams
Andreas Huber
David Abrahams
David Abrahams
Andreas Huber
Andreas Huber
Andreas Huber
David Abrahams
Andreas Huber
John Fuller
David Abrahams
David Abrahams
Andreas Huber
Andreas Huber
Aleksey Gurtovoy
David Abrahams
David Abrahams
David Abrahams
Andreas Huber
David Abrahams
David Abrahams

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved