kriskowal / gtor

A General Theory of Reactivity
MIT License
3.03k stars 109 forks source link

Suggestion: Use the term “channel” for publishers and subscribers #35

Open tomek-he-him opened 9 years ago

tomek-he-him commented 9 years ago

Hi @kriskowal,

every entity you define has a single term for the thing and two terms for its input and output sockets. A deferred has a promise and resolver, a stream has a reader and writer, and so on.

I’ve noticed two exceptions to this:

  1. A task has no terms for its i/o sockets.
  2. There is no term for the thing which has a publisher and a subscriber.

I suggest naming the thing a channel. The real-world analogy is a radio channels. When you publish things to a radio channel, you don’t care who’s listening. The number of listeners can be anything from zero to infinite. When listening to a radio channel you can freely switch it on and off (subscribe and unsubscribe).

The term seems to be used already:

I have no idea for naming the task sockets yet.

bergus commented 9 years ago

Hm, notice that the term channel is already taken for CSP (see #20), where it has a slightly different meaning. The important differences are:

So they're not exactly broadcast like pub/sub.

That "thing" you describe is not one of these entities with single input and output sockets - instead, there can be any number of publishers and subscribers. The Wikipedia article uses the terms topic, (message) broker and (event) bus, which are fitting better imo.

kriskowal commented 9 years ago

@bergus A CSP channel is what I call a stream. Although this frees up the name “channel” to mean whatever I chose in the context of this article, and although I like the channel metaphor @tomekwi describes, I see no need to confuse. I think I will use “topic” as the composite of “publisher” and “subscriber”. I also need to expand on what distinguishes streams and topics regarding “completeness” (whether messages must be replayed from the beginning through to the end for each consumer), “order” (whether there is an intrinsic order to the messages), and “integrity” (whether a message is guaranteed to be delivered, and therefore whether the producer must wait for the slowest consumer) in addition to “broadcast” vs “unicast”. Without “integrity”, a publisher can have the interface of a synchronous generator, and the consumer can have either a synchronous observer for a “discrete” topic and a synchronous iterator for a “continuous” topic. And so on if I find some time to talk about time series data and logging scenarios in detail.

tomek-he-him commented 9 years ago

I think I will use “topic”

:+1: maybe not as figurative – but it’s definitely a good thing to avoid confusion with CSP.

I also need to expand on…

Thanks for all your effort @kriskowal. The GTOR helped me massively. It’s bull’s eye now that RP is gaining in popularity :)

kriskowal commented 9 years ago

@tomekwi Please link a resource on RP. Perhaps oddly, not sure what that acronym expands to.

tomek-he-him commented 9 years ago

I just meant Reactive Programming :)

kriskowal commented 9 years ago

Ah, of course. Thanks.

tomek-he-him commented 9 years ago

@kriskowal, by the way, I have to take back the claim that “A task has no terms for its i/o sockets.

It just occured to me that

a task has mostly the same form and features as a promise.

– so it looks like a task has a promise and a resolver as well as a deferred does. You already use these terms for a task anyway, so it seems:

With a task, information flows from the first call to a resolver method […]