Jump to content

JKI State Machine + UI


Recommended Posts

I've recently picked up the JKI state machine and am really enjoying it. However, I have a (hopefully not stupid) question regarding the UI aspect of it.

From what I see, the event structure only ever executes while the state queue is empty. In this event structure you put controls that you want to use to trigger new actions and other controls you put in a case to read as necessary? How then do you ensure responsiveness from one of the event controls if the state machine is off running for awhile through the queue? For example to have the program respond to a click of the built in 'OK' button and stop execution immediately rather than waiting an indeterminate amount of time while emptying the queue?

Perhaps my thoughts aren't too well organized, but any pointers to discussions or just some advice would be great. I think what I'm after may be an asynchronous design and to move the event structure to a parallel loop? A simple example would probably speak a 1000 words here.

Link to comment

Hi,

I use a variant to the JKI state-machine for almost all of my work. It is a strategy that has it's purposes. Generally it is used for UI loops, where states are only executing after some user interaction. It can be used in other situations too, but this I prefer this type of state-machine for UI loops. (Semi-)deterministic architectures will differ for their specific needs. States generally execute quickly, unless the user is required wait for something. (I used a busy cursor when it is desired for the user to wait.) If the states do not execute quickly, (such as timeout case - screen updates) I would optimize/strip the code until it is within the responsiveness requested. Anything that is required to always run, but, does not execute quickly enough, another loop will be used.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.