Up or down?
I am a very visual person. I see my application as a hierarchy, where the top is the root and the bottom is the leaf.
I also understand that on DI systems, containers do not know the responsibilities / functions of their contained objects. Instead, the contained objects know their context, because context (dependency) is introduced into it.
UP: (non-DI method)?
Should my events go from my lower hierarchy and bubble up to their parents? For example. a button in my GUI dispatches an event CLICKEDthat is captured by the listening container, which responds by performing the appropriate action.
DOWN: (path DI)
Should my events be sent from the top of my hierarchy by a parent who his children are listening to? For example. -... well, I have problems with this. I think along the lines of an intermediary that sends events for contained objects.
'Up' seems natural to me, but since DI does not have a container that is unaware of the behavior of its contained objects, I would not want to respond to their events.
EDIT (specify):
I understand that it is possible that almost any part of the system listens for an event, but I want to understand the fundamental relationships between DI participants, so I can structure them correctly. I assume that people usually do not just scatter events about their program without taking into account structural relationships, dependencies, etc.
- DI - ( -DI - , " " " " ). , -, , DI - . , BOTH . , , , KNOWS , , . . , DI , , , . . , , , , , - .
, , .