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

I've worked in the past with code bases that have what were called 'state machines' implemented with at best switch statements and at worse a lot of if's and else's and some state variables.

I've also worked with code bases with a formally defined state machine object/concept, with pre-defined states, events, and state transitions driven by events.

Question for the crowd: what would you call the non-state machine state machine in the first case?



I would call the former an implicit state machine, while the latter is an explicit state machine.


This is perfect, thanks!


You'd probably still call it a state machine if that is what it's doing. Maybe not well implemented but it also depends. State machines are tricky to get right.


> what would you call the non-state machine state machine in the first case?

Ad hoc state-machines? I don't think there's a formal name for them.


Ad-hoc is a great term for this, thanks.


State machines implemented in-line with code usually end up as a mess. It's best if they are factored out, and implemented as a DSL inside a true state machine engine running as a somewhat independent service or library.




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

Search: