| This is very similar to my biggest frustration with PubSub, or heavy event driven systems in general. The concept is so appealing, “Hey I’ll just fire this message off and whoever needs to know about it will do what they need”. It’s great to have that ability to focus on just the component or module you’re working on, but the lack of visibility on exactly what is about to happen, and what has happened, has caused many late nights of debugging and frustration. It’s just how you described “there’s absolutely no way to tell the code that was going to get injected” I’m guilty of contributing to this problem as well. Once you become familiar with the event system you’re working in, windows, DOM, whatever, you can make some pretty good assumptions about how other components are implemented. When you’re faced with a bug in code you don’t have access to, or a behaviour you don’t want, often the solution you’re left with is asking “okay, so what combination of events and timing do I need to force this component into the state I need?” For example I remember doing this with some third party grid controls. We really really wanted the TAB key to insert a new row at the end. We had to orchestrate exactly the right mix of events and method calls in the right order, with a few BeginInvokes to get the job done. I wish I had a solution to all of this and other frustrations. It’s all trade offs and a balancing act. |