question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Code health] Verify usage of Rx side effects

See original GitHub issue

There are some instances in the code in which we rely on doOnNext, doOnSuccess and other RX side effect operators.

In general, we should either avoid side effects entirely or ensure their usage is carefully prescribed.

Personally, I like treating anything that does not have to do with the direct manipulation of data (emitted items) as a side effect. For example, logging and UI changes would both be considered side effects from this perspective. I think this approach enables us to maintain clear separation between the actual ‘transformation’/ data-manipulating code and ‘side-effecting’ code like logging.

For our purposes, we only need to treat logging as a side-effect, since display related code is handled by fragments (and ideally live-data binding). The majority of cases in which we manipulate some piece of data in a doOn function can be expressed using transformations instead.

@gino-m

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
gino-mcommented, Jun 9, 2019

Just came across this in Google Rx MVVM example:

https://github.com/googlesamples/android-architecture/blob/2e20b4a5deffb354f5ffa01c7f4448fd37acb6c3/todoapp/app/src/main/java/com/example/android/architecture/blueprints/todoapp/tasks/TasksViewModel.java#L77-L84

They’re using side effects for loading state indicator as well as errors. Arguably more readable than using a wrapper class, esp. since there’s no downside to doing so in this particular case afaict.

0reactions
gino-mcommented, Jul 16, 2020

Latest guidance is in our Wiki; let’s identify these as we go, closing for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Question - Coding Normal Side Effects of Drugs - AAPC
5 (a): When coding an adverse effect of a drug that has been correctly prescribed and properly administered, assign the appropriate code for...
Read more >
ICD-10 codes used to identify adverse drug events in ... - NCBI
We found a total of 827 ICD-10 codes that have been used in the medical literature to identify adverse drug events.
Read more >
Drug Side Effects & Medical Device Complications - Drugwatch
Drug Side Effects & Medical Device Complications ; Common minor side effects of prescription drugs: Diarrhea ; Minor side effects and complications from...
Read more >
Finding and Learning about Side Effects (adverse reactions)
FDA's FDALabel database is used to perform customizable searches of thousands of drug labeling including searching for side effects for a drug. ...
Read more >
Drugs.com | Prescription Drug Information, Interactions & Side ...
Prescription drug information and news for professionals and consumers. Search our drug database for comprehensive prescription and patient information on ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found