Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Agreed. When I worked on last years Advent of Code problems (amazingly good problems btw) I ended up writing many solutions as small FSMs.

Typically you read a token, moved to a new position and then acted based on the current state and the token, position. You don't need a library since the code is just a few switch statements.

https://adventofcode.com/2017



And then everything ends up in Error state with no history. At least function stack has stack traces...


FSM's usually don't have error states, you tend to crash them first.

Though that is preventable, mostly because the code you run is inbetween transitions and that will return very nice stack traces.

Otherwise, you don't need a trace of a state machine, the state you're in and the current transition should tell you exactly where it's breaking.

If it doesn't, chances are you're breaking state machine definitions by storing wildly complex state outside the machine.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: