start state

Table of Contents

start state is present in lots of notations.

1. lots of notations

  • Deterministic Finite Automaton: \(\{Q,\Sigma,\delta, q_0, F\}\) - \(q_0\)
  • programming languages: main method
    • python - \(__main__\) or the whole script itself
    • emacs-lisp - the whole script itself
    • clojures - \((-main)\)
    • java - \(Main.main()\)
    • C - \(int main()\)

2. usefulness

  • a deterministic flow of instrucitons for compiler
  • a deterministic flow of instructions for yourself to reason
    • bugs
    • safe guard from danger states

when programming with state machine, state actions and transitions are easy to design and translate from natural language.

yet without a start state, the program cannot be run, and more importantly, if init to a random state, the program is very likely to break due to side-effects and dead-reckoning between the state and real-world situation.

For example, for a click-and-drag HTML element, if the start state is at “dragging”, the element would move when you are not dragging it, or even when you don’t have your cursor on the element, which is a bug in every sense.

Backlinks

Author: Linfeng He

Created: 2024-04-03 Wed 23:23