-
Notifications
You must be signed in to change notification settings - Fork 534
Remove Consumer/Processor/Producer #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Simplify to the the minimum viable types to allow interop without conflating concerns.
Agree on producer/consumer but actually processor can be justified at least I don't see an issue with it implementing publisher/subscriber which the tck already states in fact. Sent from my iPhone
|
What is the use case for |
I'll have to sleep on this one. An addition to your 4th point: We'll have to be very clear about User's use of any Subscriber methods. (i.e. they are only ever intended for the active publisher to use). As for Processor I think the risk is that every library will have to create its own implementation of this, and they will all be incompatible (binary) and IIRC only Scala's type system is "sophisticated" enough to be able to represent |
Sure, but I don't see how this isn't obvious. People know how to use listeners/observers/callbacks, this isn't a foreign concept we're thrusting on people. If people are going to invoke the More importantly though, hiding the |
|
@alexandru "and I think the spec could be more clear in that regard." What is unclear? |
@benjchristensen There is one thing you will notice while fixing the TCK: IdentityProcessorVerification (which contains several useful rules of how various signals propagate in a processing network) requires you to create a type which implements both Subscriber and Publisher. This alone is probably enough reason to keep this type available for all implementations to use. |
As per discussion at #19
Closing and will re-create once decisions are made in #19 (comment) |
As per discussions in #24, #23, and #22 I recommend eliminating the
Consumer
,Processor
andProducer
types and focusing purely on the interop types.I spoke with @viktorklang on Skype about this topic and with him decided to submit a pull request to push the conversation forward.
NOTE: This does NOT fix the TCK which will not compile with this change. I want to determine if there is agreement before exerting that effort.
Why?
1) Simplicity
We should strive for as few types as possible to accomplish the stated goal of library interop. The
Publisher
,Subscriber
andSubscription
types achieve this without need for the other 3.Publisher
,Subscriber
andSubscription
clearly communicate their behavior and relationships via their signatures whereasConsumer
andProducer
do not.2) Not succeeding in hiding SPI
The
Producer
andConsumer
types are empty synonyms toPublisher
andSubscriber
and do not succeed in their effort to "hide"Publisher
andSubscriber
from users since Java does not support "friend" style modularity. The types are public and thus accessible. In fact, theConsumer
andProducer
types immediately expose thePublisher
andSubscriber
types anyways.3) Focus
This spec should not get involved in how processing pipelines will be established and thus should not have the
Processor
type.Interop will always occur at explicit boundaries where a library exposes either a
Publisher
or aSubscriber
. These clearly communicate intent, lifecycle and capability. We do not need further abstraction, indirection, or factory behavior.4) Safety
The goal of the spec should be to clearly communicate via the types how data flows, not try and prevent users from doing "bad things" through hiding the types. Safety in this case can not be prevented through obfuscation because that just impedes comprehension which in turn is more likely to cause misuse.
Clear, easy to use types are the best strategy for communicating the right mental model which in turn will result in correct usage.