Skip to content

Convention Guide

Fahmi Akbar Wildana edited this page May 30, 2019 · 13 revisions

When designing a State Machine, you need to know the purpose. Each State Machine has a slightly different convention.

State Machine for...

Manage users workflow

  • When the element name of the State Machine similar to each other:
    • Rename the state as past tense when it has the same name as the event. However, try to avoid this because not all world languages have a past tense verb
  • For the event name, the name must answer this question:
    1. What is the event? (Answer: pay)
    2. How to trigger it? (Answer: by clicking the button or hit the enter key)
  • Use Protocol Transition when you want to explain the lifecycle of some states

Manage system processes

  • Always think about how the system can recover from failure
  • Usually, they use self (loop) and backward transition to recover from failure
  • Use Protocol Transition when you want to explain the lifecycle of some processes

Creating deterministic A.I

  • use Behaviour Tree (HSFM & Behaviour Tree) or
  • shape it as acyclic graph (no self or backward transition)

Manage resources or data

  • utilize State Management library or
  • rely heavily on invoking/spawning services and calling actions
Clone this wiki locally