Jump to content
trobertson79

Why does JKI State Machine course tell us to add states to the front of the queue?

Recommended Posts

I was surprised to hear in the state machine course the best practice of adding states at the front of the state queue.   I've always added them at the back under the theory that I'm "queuing up" states to be run, but I don't want to hijak the order of exectution if there's already seme states enqueued.   The only time I add to the front is in an interrupt type situation.  Can someone explain why adding to the front would be considered best practice?

  • Like 1

Share this post


Link to post
Share on other sites

Hi @trobertson79. It's a great question!

The sort of simple answer is this:

In most programming situations, the developer should pick one way or the other (either add to front or add to back).  Mixing front and back is a recipe for hard debugging. And, since the template already enqueues at the front then this is why we recommend to stick with that.

Share this post


Link to post
Share on other sites

Join the conversation

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

Guest
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.

Loading...

×
×
  • Create New...

Important Information

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