Hacker News new | ask | show | jobs
by mkarliner 16 days ago
I posted the above reply at around 3am and I've had a coffee now.

ThingStudio, like Node-RED is built with chains of coroutines.

Coroutines and state machines (which I take to mean table driven state machines) are (mostly) functionally equivalent. I'm prepared to take some flame about this :-).

I think most people find it easier to write the pseudo-linear code of coroutines than define formal state machines.

However, a small anecdote is worth relating. Quite a bit of this code was AI generated, and there is a wire protocol between the front and back ends. After a while I was somewhat uneasy that I didn't know enough about this so I ask the AI for a proper human readable doc on the protocol. After watching it thinking for a while, I realised it was trawling through the code. A couple of questions later revealed that my suspicions were correct and the protocol was just free code. I didn't much care for this and told the AI that I wanted it re-written as a table driven state machine. Interestingly, it took a couple of interations before it could grasp the concept properly. And this was one of the current top models. :-)

I tell this story to illustrate that I fully grasp the value of state machines. My first implementation of one was when I made a DSL to define an implementation of X.25 around 1979, so I have some history with them.

The real point to make event driven programming easier.