These are chat archives for ReactiveX/RxJava

19th
Nov 2015
Javier Domingo Cansino
@txomon
Nov 19 2015 09:15
heh, guess what exception I am getting now...
rx.exceptions.MissingBackpressureException
Artem Zinnatullin :slowpoke:
@artem-zinnatullin
Nov 19 2015 09:16
:clap:
You did it :smile:
Javier Domingo Cansino
@txomon
Nov 19 2015 09:19
yeah haha
Javier Domingo Cansino
@txomon
Nov 19 2015 09:54
onBackpressureDrop() FTW
Javier Domingo Cansino
@txomon
Nov 19 2015 13:58
So I found a limitation with the android API, and would like to know how you use to overcome it... CompoundButton's change listener is always called, regardless on if you change it programmatically or the user changes it...
What does people in rxandroid do with this limitation? Do you create you own button implementation?
David Stemmer
@weefbellington
Nov 19 2015 14:15
Why wouldn't you want it to always be called?
Javier Domingo Cansino
@txomon
Nov 19 2015 14:15
@weefbellington the problem is that it is called always, and you don't know if it's you the one that changed the value or the user
usually API callbacks have a Boolean fromUser argument that gives you the hint
David Stemmer
@weefbellington
Nov 19 2015 14:16
Why do you need to differentiate is my question?
Javier Domingo Cansino
@txomon
Nov 19 2015 14:17
@weefbellington because user updates in the UI trigger model updates, where as model updates that trigger UI updates should not trigger model updates
David Stemmer
@weefbellington
Nov 19 2015 14:29
This doesn't really sound like an Rx question. One thing you could do though is set a tag on the view
Javier Domingo Cansino
@txomon
Nov 19 2015 14:29
oh it's not really Rx limitation but Android with Rx
Dorus
@Dorus
Nov 19 2015 14:29
Would something like distinctUntilChanged help?
Still, it smells and you would think there are better solutions that avoid it.
Javier Domingo Cansino
@txomon
Nov 19 2015 14:29
@Dorus afraid not, it would change, for example, like this
Dorus
@Dorus
Nov 19 2015 14:30
a tag or something could work yeah
Javier Domingo Cansino
@txomon
Nov 19 2015 14:30
yeah, those are the usual solutions
I am writing a feature request to the android project
David Stemmer
@weefbellington
Nov 19 2015 15:02
CompoundButtons are a bit of a pain. For example I wanted a CompoundButton that would only toggle the state programmatically, not when it was tapped. I had to extend the class to get the effect when I wanted.
Javier Domingo Cansino
@txomon
Nov 19 2015 15:03
yeah, I know, that's why I am sending the request upstream
David Stemmer
@weefbellington
Nov 19 2015 15:03
I wouldn’t be surprised if there were a better 3rd party compound button implementation
Javier Domingo Cansino
@txomon
Nov 19 2015 15:03
I think they suffer that broken API consequences too
David Stemmer
@weefbellington
Nov 19 2015 15:05
starr'd
Javier Domingo Cansino
@txomon
Nov 19 2015 15:08
expecting an irc guy in 3
2
1
xorgate
@xorgate
Nov 19 2015 15:08
you're already 10 seconds late!
Javier Domingo Cansino
@txomon
Nov 19 2015 15:08
haha
Dorus
@Dorus
Nov 19 2015 15:27
Design nitpick: Instead of one function with a boolean, make two functions, one with boolean true and one with boolean false. Like, doChange(...) and doChangeSilent(...)
Javier Domingo Cansino
@txomon
Nov 19 2015 16:02
@Dorus that is the proposal from http://stackoverflow.com/a/29660873/327927
Javier Domingo Cansino
@txomon
Nov 19 2015 23:41
so, I was talking with a guy that has been doing android dev past years and he spoke against Rx because of not being able to decouple business logic from the activity, this is, that Rx is more a framework than a library, so if you use Rx, and it gets unsupported, you will have to change all your code
David Stemmer
@weefbellington
Nov 19 2015 23:42
I can see the logic of Rx being more of a framework than a library
but I don’t know what is meant by “not being able to decouple business logic from the activity"
Dorus
@Dorus
Nov 19 2015 23:43
It's more of a paradigm.
Javier Domingo Cansino
@txomon
Nov 19 2015 23:43
well, if it's a framework, you have to code around it
yeah
he spoke me about hexagon
or sth like that
David Stemmer
@weefbellington
Nov 19 2015 23:44
there’s nothing intrinsic to reactive programming that has anything to do with Android, or the Activity in particular
Javier Domingo Cansino
@txomon
Nov 19 2015 23:45
and about clean paradigm maybe?
Dorus
@Dorus
Nov 19 2015 23:45
You use it just like you use a for-next loop. It has many uses but it's not a framework. Or compare it to a design pattern. Hell, it's pretty much a extended version of the classic observer pattern, or publisher/subscriber.
David Stemmer
@weefbellington
Nov 19 2015 23:46
ehhh
whenever I see an application architecture that’s described as an acronym, I reach for my bazooka
looks like a solution in search of a problem to me
Javier Domingo Cansino
@txomon
Nov 19 2015 23:53
well, his complaint was that you couldn't decouple anything with Rx because at the end you generate chains
In my opinion if you do it right, it means you have a way to create your flows
in an unique way
Dorus
@Dorus
Nov 19 2015 23:54
the opposite is true
one thing that is important i think is to separate sources and subscriptions.
Javier Domingo Cansino
@txomon
Nov 19 2015 23:55
I agree, the problem is, how do you do that, in for example android...
is out there any app that does actually have all that kind of separation?
Dorus
@Dorus
Nov 19 2015 23:55
you create a observable in one point, and in another you reference it and subscribe. Can't be easier.
Javier Domingo Cansino
@txomon
Nov 19 2015 23:55
I mean, an app I can use as a guideline
@Dorus but usually all the examples of Rx are all in oneliners, the thing is (at least for me) to have not only a how to create all the stuff but also how to organize it
Dorus
@Dorus
Nov 19 2015 23:57
for example i liked your helper function that created the observable for events.
Javier Domingo Cansino
@txomon
Nov 19 2015 23:58
yeah, that is a nice one indeed