android10 / android10/Android-CleanArchitecture

Composing Use Case observables

Offen
#121 44 Kommentare 13 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
discussion question
Vorherrschende Sprache
Java
Sterne
15.5k
Forks
3.3k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Hi guys, great project, at my company we have based an app on this template and the principles in the accompanying blog post.

For some more advanced features in the app, we ran into an issue that is very similar to another one mentioned by @amatkivskiy (https://github.com/android10/Android-CleanArchitecture/issues/63). We would like to be able to compose and combine use cases together to form new use cases.

As mentioned, RxJava provides a huge toolbox of operators for composing observables which would be perfect. However, the Use Case interface in this project accepts Subscribers and doesn't expose Observables directly.

This makes it awkward to compose and combine use cases with RxJava operators. The approach I went with was first to use Subjects to adapt the subscriber interface into an observable, then to create a new custom observable. This works but isn't great as there's a lot of nesting and boilerplate.

I was wondering what the reasoning behind the design choice of having Use Cases accept Subscribers rather than returning Observables is? Is it so that Use Cases hide the knowledge of which scheduler is used to subscribe on/observe on? What would be the downsides of having Use Cases return a single Observable?

I'm still new to using Rx in an Android app architecture, so I'm keen to hear some discussion around this and learn something. Thanks again for contributing this to the community :)

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Beginnen Sie mit der Überprüfung des Use Case interface des Projekts und damit, wie es Subscribers akzeptiert, anstatt Observables bereitzustellen. Vergleichen Sie dieses Design mit dem im issue und im verlinkten issue 63 beschriebenen RxJava-Kompositionsansatz; ein klar definiertes Ergebnis würde eine abgestimmte API-Richtung und Akzeptanzkriterien erfordern, da keine Datei, kein Test und kein konkretes Implementierungsziel genannt ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java
Bereich
mobile-dev
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
20/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.