-
Notifications
You must be signed in to change notification settings - Fork 10
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
subbed EventBus for Otto in third-party libs doc #48
Conversation
|
||
An event bus tailored to Android, Otto supports communication between distinct application components, when the use of a traditional interface is inadequate or cumbersome. | ||
An event bus tailored to Android, greenrobot's EventBus supports communication between distinct application components; generally, the event bus should only be used when a traditional interface is inadequate or cumbersome, or an event is broadcast to multiple listeners at once. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should removegenerally, the event bus should only be used when a traditional interface is inadequate or cumbersome
, event bus shouldn't be used simply as way of avoiding passing callbacks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, I know that's your position, and I generally agree with you; I don't oppose removing it. Are there any cases where you want strong decoupling, for which you'd entertain the idea of using the bus? The service-activity/fragment example is popular, but you can certainly connect to the service and treat it like an interface, though that connection step is async
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would then be a matter of how many activities can be bound to a service. If multiple activities are listening for the service and/or the service is not bound to any particular activity, the event bus would be appropriate. However, if the service should only be active when a certain activity is active, then a connection interface would be better.
Hi @weathersboyle, @f2rf2r, just restarting this convo here - is there a common denominator of an edit from this conversation? It seems like the change from Otto to EventBus is certainly helpful. While I do think that the 'generally' statement is a bit redundant, I don't think it's so bad. After all, when an interface is inadequate or cumbersome is totally up to the developer. There is no bad recommendation here per se. |
c83e672
to
253723c
Compare
No description provided.