I'm actually not having UI in mind, I'm thinking about decoupling of business logic from input events. Right now I have a chain of producers which gets byte buffer from some place (static test data, will later be provided by hardware I/O, doesn't matter for the question though), parses them into well-known commands (described as sealed class) and then updates data layer consisting of several classes with `BroadcastChannel`s. Now I'm working on the logic itself which should act on these classes, and that's where the question regarding collection arises -- there is a collection of entities which can change over the lifetime, and I want to react to these changes.
Thinking about it a bit more -- every entity has unique tag, so it's probably just a matter of an additional sealed class with
Added(tag, value)
,
Removed(tag)
and changes to the entities themselves should be covered by their own channels.
Or am I missing something?