nhoxbypass
nhoxbypass

Reputation: 10152

Google Agera vs rxAndroid

When I first step into reactive programming in Android I found rxJava and rxAndroid which prefer by many developers in the world. But today I found another library called Agera of Google which still in maintain process (last commit is 2 months ago).

It looks like rxJava at first glance, but has more meaningful api names which help me easy to understand reactive programming. More important, awesome developers at Google is using it in their project (Google Play Movies) and I believe there is reason for that.

I want to know whether Google Agera supposed to be more light-weight? And how about the performance compare to rxJava and rxAndroid? Is there any big company use it in production? Did I need to learn it to understand reactive programming in Android?

Upvotes: 3

Views: 987

Answers (1)

LordRaydenMK
LordRaydenMK

Reputation: 13321

A nice comparison from David Karnok (RxJava maintainer) can be found in the issues on Github.

I've glanced over the documentation and my impression is that Agera is almost a 1st generation reactive library with strong 0th generation ties. To put it in perspective:

  • 0th generation is when you have addListener/removeListener and update() with or without an actual value. java.util.Observable and most GUI frameworks can be considered 0th gen. It is possible, although generally cumbersome to make a composable, native library out of them.

  • 1st generation is what the Microsoft folks invented back in ~2009. It's a step upwards with straightforward architecture and great composability. However, their concept has some shortcomings discovered in late ~2013. Example: Rx.NET, Reactive4Java

  • 2nd generation is what RxJava 1.x currently is. It fixes the synchronous cancellation problem, introduced some optional backpressure and the notion of lifting into a chain.
  • 3rd generation is the Reactive-Streams initiative with fleshed out, standardized APIs, designed ~2015. The architecture is reactive-push with backpressure. Examples are Reactor 1, 2 and Akka-Streams.
  • 4th generation is the cutting edge of the field. It builds on Reactive-Streams and adds an adaptive push-pull option, in the form of operator-fusion, that allows both efficient synchronous and asynchronous use. Example is Reactor 2.5. (RxJava 2.x is in between 3 and 4 right now).

I know this is an optional library, don't use it if you don't like it. Don't get me wrong, it's not about how many operators you have, how strong do you inline your reactive library with the underlying platform or that you don't care about backpressure in GUI. It's about the architectural experiences, pitfalls and possibilities of the Rx family that maybe could have helped/inspired this library. If Agera were based on Reactive-Streams or designed in spirit of it, I'd say okay, why not.

As for the original questions:

Isn't it RxJava reinvented?

No.

Is it supposed to be more light-weight?

Seems so API-vise, not sure about performance-vise

Complementary?

As complementary as addListener-based APIs are in general. The name conflict of Observable and Supplier may be of some inconvenience.

Or just inspired?

Apparently not inspired by Rx.

Google Play Movies and we like to open source code whenever possible

In Netflix' footsteps I see. You see, they got significant help along the way...

Upvotes: 7

Related Questions