VI High 58 - How to Make Your State Machine Event-Based

Поділитися
Вставка
  • Опубліковано 13 вер 2024

КОМЕНТАРІ • 3

  • @AndySoukup
    @AndySoukup 10 років тому +1

    If the status display is always equal to the state enumeration text, it'd be much more future-proof to go before the case structure and use "format into string" to convert the enum into a string and write it to the Status indicator. This would take care of all cases with one instance of code. when more cases are added, the new status will be taken care of when you edit the enumeration. oh, and it also would force you to write legible state names (-:

    • @Sixclear
      @Sixclear  9 років тому

      Great point Andy! It's sometimes tricky to write strings that are meaningful to the user as a status while being useful to the programmer as a state. In the state machine in this video, that would be pretty easy. I've found that as my state machines get more complicated, it gets harder to do both. However, if you can be disciplined enough to do it as you said, that could also save some time. Great comment!

    • @mectigran
      @mectigran 9 років тому +1

      Andy Soukup Why not just create an indicator no need to bother converting it to display the status. A follow up question is how to display these states with a delay when your loop runs very fast and jumps through the states. Is there an easy way to do this?