Concern: code structure #49
Replies: 1 comment 4 replies
-
Yes, the event-based architecture does sometimes require the programmer to split a logically continuous operation in multiple event handlers. In particular, this is exclusively the case of cryptographic operations (signing / verifying, hashing). I can also imagine other operations that break the control flow (e.g. persisting to durable storage or other I/O like sending messages), This leaves us with cryptographic operations. Fundamentally, this is the options that I see to address the concern of event handler fragmentation:
I think that the above options apply regardless of whether we adopt an event-based model or not That said, I'm still very open to exploring other options for addressing the concern. |
Beta Was this translation helpful? Give feedback.
-
Original concern
Mir's event-based architecture seems to induce
code fragmentation since handling of individual events is supposed
to be simple, fast, and non-blocking, i.e. expensive or complex
operations should be split or delegated to separate modules.
Admittedly, one can still maintain decent level of code readability
by placing logically connected event handlers next to each other in
source code. However, splitting otherwise logically continuous
operations into multiple event handlers makes them non-atomic. This
can become a source of concurrency bugs and complicate logical
reasoning about correctness of the implementation.
(copied @sergefdrv 's post in umbrella discussion #46 )
Beta Was this translation helpful? Give feedback.
All reactions