I am trying to build a DSL for my iOS project.
For this I plan to build a Semantic Model
in a form of a State Machine
. (The terminology is from Fowler's book on DSLs).
The main idea: State Machine
is coded as the set of states
and transitions
between them, and then some unit tests can be written to check if some_action
on some_state1
leads the system to a some_state2
.
The problem is my app has a lot of background threads, so more than one state can be active in State Machine at a given moment.
I've read that such State Machines are Nondeterministic finite automaton
, skimmed through wiki page, but that looks too theoretical for me.
Here is an example state machine:
s8
can be activated only when it received t7
and t8
, that means it should "wait".
The questions:
1. Is there something like "wait"
in state machines?
2. Maybe, this is not NFA, but two state machines? Should I care how to name this kind of semantic model at all?
3. Is it OK to s8
be implemented with some background thread, which accepts notifications from s4
and s7
, and is activated only when both of them sent notifications (this means that the unit test fail when timeout is reached, and then that timeout should be mentioned somewhere in a model) ?