3 ms·
This is a really good take on the (still unsolved IMO) problem, though I suspect it only makes sense to people who have experienced all the issues personally, s
by IshKebab 6y ago
This is a really good take on the (still unsolved IMO) problem, though I suspect it only makes sense to people who have experienced all the issues personally, since so many of them are "it gets really awkward with big programs" type problems.
He did miss out a pretty significant flaw of message busses - the producers and consumers of messages are completely decoupled, which makes debugging really annoying because you don't have anything like a stack trace. You just know that your component received a message, and good luck trying to figure out where it was sent from and why.
That's also a big problem with magical reactivity systems like Vue. Your stack trace is pretty much "yeah something changed somewhere so we're updating this component. Don't try and figure it out."
- RoyalSloth 6y ago> the producers and consumers of messages are completely decoupled, which makes debugging really annoying because you don't have anything like a stack trace This is actually a really good point. I don't know why you were downvoted.
- pixel_tracing 6y agoThere’s always a stack trace. The question is figuring out deep your eventing layer is. Also dispatching an event on one thread and receiving it in a component on another thread essentially negates the trace in this sense too (sometimes depending on your environment). A solution I’ve always had is to build your message bus with logging in mind initially
- IshKebab 6y ago> There’s always a stack trace. I think you misunderstood. Of course there's always a stack trace; you're still executing code. But with message buses and magic reactivity systems your stack trace always just goes to `mainEventLoop()` or `processEvents()` or whatever. It doesn't go to the thing that actually caused the change as it would if you used direct function calls. I'm not saying it's a deal breaker, it's just a notable downside of those architectures.
- TeMPOraL 6y agoAs GP said, you have to compensate with some form of logging/tracing. At the very least, if you assign an ID to every event, then to debug an issue you can start logging sends and receives, and work out the relationship.
- IshKebab 6y agoYes you can do that but it's still worse than a proper stack trace that goes back to where the message is generated.