Hacker News new | ask | show | jobs
by toddh 5132 days ago
You might consider the Actor model. Event loop code can be a mess and threaded code while simpler because it appears linear eventually has such complicated runtime behaviours it also becomes a dangerous mess. And Actor model combines the best of both worlds. Messages are queued to an actor which combines a state machine plus its own thread or a slice of a thread. The state machine aspect and the centralization of the code around an actor object and the reliance only messages make it conceptually easy to understand and program. Actors can act as endpoints in protocols, services, publish/subscribe, timers etc so they offer a high level of abstraction away from lower level frameworks.