3 ms·
Only if the system does not have any other concurrency primitives, and if events are not recursive. Either will break your event system in ways people have trou
by hinkley 3y ago
Only if the system does not have any other concurrency primitives, and if events are not recursive. Either will break your event system in ways people have trouble understanding.
At one point in my career I’d seen and heard this failure mode so often I swore never to use one again. I don’t mean never use events, that would not be “crazy like a fox” but just regular crazy. I mean not as the organizing principle. When event dispatch is small, isolated islands of state, then the isolation prevents this from happening.
When it’s central and everyone is convinced to use it, then errors accumulate. No one can watch all parts of the system for nasty bugs. We pick our battles. But when all parts of the system (can) touch the same thing, then you have to assume everything touches everything else.
If you take the right snippets out of what I just wrote, you might think I was talking about global shared state. Which it pretty much is.
- deterministic 3y agoRecursive events is a big red flag. Every time I have seen that in the wild it was a really bad and unnecessary design choice. Using parallelism/concurrency is fine. As long as the data dependencies doesn’t have the usual multi-threading bugs (a thread modifying data that another thread is reading etc.)