Settings

Theme

Solving State Explosion with Petri-Nets and Vector Clocks

github.com

86 points by orksliver 9 years ago · 11 comments

Reader

teleclimber 9 years ago

> The Problem: https://barrgroup.com/Embedded-Systems/How-To/State-Machines...

The article linked spends a lot of time looking at an event-based calculator in VBScript that evidently has a lot of bugs. This is used as a justification for doing what they do (whatever that is? I don't really get it).

My problem with this is the calculator program is very poorly written. One could probably get rid of most of the bugs by using a "single source of truth" state object that includes all state data necessary for all events to act correctly.

The calculator program is buggy because the programmer is apparently not thinking holistically, and is patching bugs as they are found by adding another little state variable here and there. The result is just what you'd expect.

But this is largely a solved problem. The React folks developed Flux[0] to get away from these kinds of situations.

I guess my point is I can't be bothered to go study what a bitwrap is all about given the problem it solves is moot when using good design techniques.

But if someone can explain the problem better, I'm all ears.

[0] https://facebook.github.io/flux/

  • orksliverOP 9 years ago

    > But if someone can explain the problem better, I'm all ears.

    Assuming you mean it...

    Here's a youtube video about the benefits and attributes of event-sourcing. https://www.youtube.com/watch?v=8JKjvY4etTY

    Though the demo project is presented in the browser, I'm trying to demonstrate that I can model the game of Tic-Tac-Toe using a much smaller and comprehensible (I hope) graph.

    Additionally - because these are mathematical graphs I'm speaking of - it means the 'program' that the graph represents - can be expressed as pure math ( which is nifty to say the least )

    A classic DFA would have to represent all the permutations of the board like so: https://upload.wikimedia.org/wikipedia/commons/1/1f/Tic-tac-...

    • teleclimber 9 years ago

      Ah, seeing the tic-tac-toe graph and comparing to yours gives a much better idea what you're trying to do. Interesting! Thanks.

  • orksliverOP 9 years ago

    Hi thanks for the feedback:

    Just a few comments in response:

    > event-based calculator in VBScript

    It's mostly coffeescript

    > My problem with this is the calculator program is very poorly written.

    It's a demo - also the coffeescript is only there to show how the python server works. ( I'll update the docs to explain this better )

    > One could probably get rid of most of the bugs by using a "single source of truth" state object that includes all state data necessary for all events to act correctly.

    This is in fact what exists -- the "single source of truth" in his case is the python event store - My pooly written UI is only there to forward events server-side.

    > But this is largely a solved problem. The React folks developed Flux[0] to get away from these kinds of situations.

    Front end UI isn't my focus - building a quality event store is.

    I'd love to find other state machine implementations that have similar properties.

    Thanks for your post - I know everything is poorly documented - I'll take your criticism as a guide to fixing that.

orksliverOP 9 years ago

https://www.reddit.com/r/compsci/comments/5yktdo/tictactoe_s... <- Related post focusing only on the TicTacToe State machine.

  • orksliverOP 9 years ago

    "Cool! I'm doing DFAs with my fifth graders right now and I'm definitely showing them this." :)

stabbles 9 years ago

Never heard of petri-nets before, but familiar with ES. Do you have some good references as an intro to petri-nets?

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection