2021/11/05/notes for event-system burndown: Difference between revisions
mNo edit summary |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
{{nav/codeblog}} | |||
[[category:ferreteria]] | |||
The current system for internal events (intEv) (as opposed to loggable events (logEv), which is entirely separate) seems suboptimal. It doesn't allow passing data, and it may be making call-tracing more difficult. | The current system for internal events (intEv) (as opposed to loggable events (logEv), which is entirely separate) seems suboptimal. It doesn't allow passing data, and it may be making call-tracing more difficult. | ||
Latest revision as of 00:05, 2 July 2022
The current system for internal events (intEv) (as opposed to loggable events (logEv), which is entirely separate) seems suboptimal. It doesn't allow passing data, and it may be making call-tracing more difficult.
The intEv system is for when you have a tree of objects which all need to be alerted when the system enters various stages of processing, so they can work in synchrony and without stepping on each other's toes. For example, at one stage, we may need to set a bunch of values without taking any further action, and then a subsequent stage will take action based on those values -- where we can't enforce any specific order in which the objects take action. The event system ensures that every object in the tree is at the same stage of readiness.
Possible changes:
- 1. (APPROVED) Create a descendable
cIntEvent
object to contain the event code and whatever data might be needed; pass that to all event methods.- This would also allow encapsulation of event codes (as class constants).
- 2. (REJECTED) I wanted to eliminate event codes in favor of named methods, for easier searchability, but I think that runs into problems where objects between the event-emitter and an event-consumer should only need to know about the types of events they consume, rather than every possible event that passes through them.
- The more I think about it, the more this wouldn't even make searchability easier. Some classes/traits already split off event-codes into separate
OnEvent[name]()
methods.
- The more I think about it, the more this wouldn't even make searchability easier. Some classes/traits already split off event-codes into separate
Revisions
Pieces that need to be updated/rewritten include:
- ftExecutableTwig
- public function DoEvent(int $nEvent) : void
- protected function OnEventDispatch(int $nEvent) : void
- abstract protected function OnCreateElements() : void
- abstract protected function OnRunCalculations() : void
- ftExecutableTree
- public function DoEvent(int $nEvent) : void
- protected function OnEventBefore(int $nEvent) : void
- protected function OnEventAfter(int $nEvent) : void
- cDropinLink
- protected function PageEvent(int $nEvent)
Decided not to pass caEvent to these methods, because they didn't need any additional info before:
- OnCreateElements()
- OnRunCalculations()
If it turns out they could work better with event data, this can be changed.