asynchronous - Where are the big UseCases to need RXJava in Android -


this more architectural question or maybe question of point of view.

many android libs have reactive approach in there apis. e.g. volley , volley have nice jsonobjectrequest put requestqueue , in callback onresponse can handle response.

or in picasso have async call load picture in given imageview.

in new persistent tool objectbox android have reactive approach set , query data database.

so question is, great needing of rxjava in android? in usecases rxjava essential?

reactive not same "observer pattern". call backs not same reactive. custom-fitted call interfaces more specific , not easy generalize reactive implementation of rxjava.

  1. rxjava follows observable contract, meaning behavior consistent within itself, , behavior readily generalizable.
  2. rxjava uses basic set of operators, java generics, provide rich customization portfolio. observable<customjsonobject> known behave in same way observable<long>.
  3. given (1) , (2), find can compose reactive operators customized behavior. hence, customjsonobjectobservable.distinctuntilchanged() behave in same way longobservable.distinctuntilchanged(). don't need create custom class stores previous item comparison, operator takes care of you.
  4. introducing passage of time or multiple threads done using operators, , these aspects composable. interval() operator provides periodic updates, buffer() operator collects data arrives within period, , timeout() operator monitors data , announces when not present in time period.

point (4) biggest win rxjava. reasoning passage of time, in presence of multiple threads of control, very hard. rxjava brings difficult areas under control. hard problems not quite hard solve, , hard problems can decomposed areas easier solutions.

volley not address hard issues. provides asynchronous responses, , addresses fraction of item (1) above. not address (2), (3) or (4).


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -