Is there a formalization to add and validate const...
# thinking-together
p
Is there a formalization to add and validate constraints on the valid intervals in which particular events can be emitted in the system? I mean there might be multiple services/objects around waiting for messages and due the combinatorical explosion we can't enumerate all the possible sequences of events. I just can't believe there is no standard/proven way/know how to generate event sequences in any programming language. To me it seems it should be part of the testing libs maybe with additional abstractions for expressing the distinct "services"/"objects", but I don't see the need for a separate programming language for that, but still, I am not aware if that in the mainstream. I am wondering why is that.
c
What would be the use case/domain this would be applied to? Something like a state machine?
d
What kind of events? I assume you're not taking about code triggered events, since those can be triggered by code. Java has something called "Robot" which lets you control the mouse and keyboard programmatically (for "testing purposes")
i
Is there a formalization to add and validate constraints on the valid intervals in which particular events can be emitted in the system?
This sounds like the raison d'Γͺtre of state machines.
I mean there might be multiple services/objects around waiting for messages and due the combinatorical explosion we can't enumerate all the possible sequences of events.
If those services or objects all share a thread of execution, then (possibly nested) state machines and their ilk are pretty much the bread and butter of organizing asynchrony. If there's any kind of parallelism happening (whether locally or across a network), then you're entering into the domain of the CAP theorem, and can pull out the coordination schemes like Raft or Paxos and the guarantees like linearizability and serializability. These are the standard and proven (in that they're formally verifiable and rigorous) means of reasoning about distributed systems. Though good luck guaranteeing that your implementation is perfectly correct β€” cosmic rays and whatnot.
This stuff is all programming language-agnostic β€” it's just the way we talk about properties of distributed software that emerge from the laws of physics.
p
@Cole just general verification. Yes exactly, I imagine a service/object like a state machine and my problem is that if there is a lot of them on top level then it is quite impossible to introduce a top level state machine (like hieararchical) without the combinatorical explosion πŸ’₯ . What I would like to do instead is add constraints on the valid ordering of events and 1. I would make sure the code really implements it. (Eg. if there is a constraint like: the eventstream can start off with E1 or there won't be any E1 in stream; I make sure the service emitting E1 is the first to emit events in my implementation and there is no other valid context in which the service is prompted to emit E1) 2. I would enumerate all the eventstreams(event ordering) with the constrains to make sure there is no ordering I missed / I forgot about. It reminds me a lot to automata theory/regexes, but to me they are closer to state machines. To me state machines are "clean" and easy and what I am looking for is how to make "cleaner" the "dirty (combinatorical) space above top level clean state machines" via temporal constrains. By temporal I mean constraints on ordering (check out Temporal Logic, especially Computational Tree Logic). I deeply believe adding/expressing constraints on ordering is REALLY easy compared to other techniques for verification. Furthermore, constraints on ordering of events has a lot to do the meaning of the software (for me), and it seems nice to me to make it explicit.
@Dan Cook I meant Events like messages between any separate Objects / Services. It can be a method call, it can be an event listened by another service, it does not matter. The only thing matters information gets through boundaries: making the clean/easy state machines/objects/services interacting with each other which is dirty and combinatorical because the timings (events emitted) are not constrained (at all).
@Ivan Reese yes, state machines are quite good, but my problem arises when there are many of them and I don't know how to add timing/event ordering constraints to enumerate all the valid possibilities.
https://github.com/davidkpiano/xstate/issues/287 Here is one of my old questions in the topic. XState is a really cool State Machine lib.
a
i had this same issue trying to apply property testing to the reducer of an event sourcing system. it would have been cool to generate valid event sequences for the purpose of testing the change in state that should be produced by a new command
πŸ‘ 1
would have been cool. never came up with a good solution
πŸ‘ 1
p
That is exactly my wannabe usecase