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

Usually your state is more complicated than just one enum. You'll have counters, buffers, etc.

The only time I've ever used a state machine in real code is when parsing text one token at a time or something like that. It's a useful skill to remember for those situations. And this kind of problem is very over-represented in SWE interviews.



Well yes, because state machines are identical to regular expressions... though regular expressions tend to be used quite a lot ?


Yeah, in most cases I won't even get into manual parsing and will use a regex instead. But sometimes I have to break out the FSM.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: