[Qt-interest] Qml & State Machines

Stephen Kelly steveire at gmail.com
Fri Dec 3 20:23:31 CET 2010


K. Frank wrote:

> People often do write event-driven systems with nested if-then
> code.  It gets complicated and hard to maintain, but in practice,
> people sometimes (and with pain) get it to work.  But trying to
> transform what I've called "extended state variables" into pure
> enumerated state values can become fully unmanageable for
> realistic (and not overly complicated) problems.  (Among other
> things, the number of states can explode exponentially.)

I don't have any opinion on the proposed syntax for creating state machines, 
but the above describes very well a situation I was in a few weeks ago after 
the last long thread on this subject (Thanks Sean for the write-up. I do 
intend to revisit that thread).

I had a large nested state machine where all possible states of about 2 
variables were represented as a QState. Some of the nestings were inter-
related, and so rather than have complex cross-transtions across the whole 
state machine I was about to duplicate some of the substates for the many 
values of one of the variables.

That's when I saw sense and drew out the whole thing in sheets of A4 paper 
and postIt notes. I looked at the result and then designed a much simpler 
system which manipulates a 'property bag'. I presume that's what you mean by 
'extended state variables'.

I just found this too, which uses an example similar to yours:

http://en.wikipedia.org/wiki/UML_state_machine#Extended_states

All the best,

Steve.





More information about the Qt-interest-old mailing list