3 ms·
Is the obscure example that you are referring to the pocket calculator state machine at https://en.wikipedia.org/wiki/UML_state_machine#Hierarchically_nested_st
by gugagore 6y ago
Is the obscure example that you are referring to the pocket calculator state machine at https://en.wikipedia.org/wiki/UML_state_machine#Hierarchically_nested_states https://en.wikipedia.org/wiki/UML_state_machine#Hierarchical... ?
Between pocket calculators and GUI events (reactive programming), I think obscurity is probably a matter of personal experience. In any case, I think the connection to GUI events is worthwhile. Thanks!
I believe there are a few important caveats to the connection:
1. The "most popular" GUI frameworks have semantics that go (way) beyond "events are delivered to the lowest level in the component graph that can handle it":
https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Events#event_bubbling_and_capture https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Bu...
https://stackoverflow.com/questions/4616694/what-is-event-bubbling-and-capturing https://stackoverflow.com/questions/4616694/what-is-event-bu...
2. You can still have this hierarchical handling of events without modeling the event handling itself as a state machine. And if you do want to model it as a state machine, and if multiple levels of the hierarchy may handle the event, I suspect you must rely on some decomposition where each layer of hierarchy can only influence some components of the state, while leaving the others unchanged.
It seems like UML state machines addresses this!
From https://en.wikipedia.org/wiki/UML_state_machine#Orthogonal_regions https://en.wikipedia.org/wiki/UML_state_machine#Orthogonal_r...
> In most real-life situations, orthogonal regions would be only approximately orthogonal (i.e. not truly independent). Therefore, UML statecharts provide a number of ways for orthogonal regions to communicate and synchronize their behaviors. Among these rich sets of (sometimes complex) mechanisms, perhaps the most important feature is that orthogonal regions can coordinate their behaviors by sending event instances to each other.
- eternalban 6y agoThanks, but note no claim was made of needing fsms to handle events [in component graphs]! /g I merely stated the [conjectured] motivation for UML's design team to introduce this level of sementics at the notational level.