Live data from Hacker News

Designing a State Machine without conditionals

jjcorrea.github.io

1–5 of 5 posts

Re: Designing a State Machine without conditionals

#3
post #2

The diagram resembles a decision table: http://en.m.wikipedia.org/wiki/Decision_table

Does the rest of the article seem to resemble a state machine to you, or do you see an obvious way that the classes he wrote could be used to create a state machine? Because I do not.

Re: Designing a State Machine without conditionals

#4
post #3
post #2

The diagram resembles a decision table: http://en.m.wikipedia.org/wiki/Decision_table

Does the rest of the article seem to resemble a state machine to you, or do you see an obvious way that the classes he wrote could be used to create a state machine? Because I do not.

Hi,

The main peculiarity about this solution is that on this case we had a complex input type, where a transition on an inner element may influence the state on the outer element.

For example, given the following structure:

- A1 (state=1)

-- B1 (state=2)

--- C1 (state=5)

-- B2 (state=3)

If the state of C1 changes, then this change should be considered by the B predicates, and so should the A predicates.

After all, for the example in specific we are returning all the updated statuses in a list, as in our case we needed to show what was the difference on the overall state after the execution.

Re: Designing a State Machine without conditionals

#5
post #3

Earlier quoted context omitted.

Does the rest of the article seem to resemble a state machine to you, or do you see an obvious way that the classes he wrote could be used to create a state machine? Because I do not.

Hi, The main peculiarity about this solution is that on this case we had a complex input type, where a transition on an inner element may influence the state on the outer element. For example, given the following structure: - A1 (state=1) -- B1 (state=2) --- C1 (state=5) -- B2 (state=3) If the state of C1 changes, then this change should be considered by the B predicates, and so should the A predicates. After all, fo…

Nice article! After deeper thoughts i finally realized what bothers me about it: It doesn´t address the inner dependencies between those transitions. By your comment above, it´s not a big deal because of this kind of hierarchical structure you described, but it was not clear when i first read it.