loading...
markdown guide
 

I'm still fairly new to both Kotlin coroutines and RxJava, but it seems to me like they serve different purposes. Coroutines are really great for making async code feel like you're writing it synchronously, but it still is mostly just writing code. Where RxJava really shines is in data transformation, and helping you structure code to making a very clear pipeline of data flow.

Coroutines are really nice for doing things like making quick HTTP requests or DB queries off the main thread with very little cognitive overhead, because you're still just writing code, it's just inside of a closure.

I've found RxJava to be really nice for doing things like chaining multiple HTTP requests together inside a single service. For example, hitting one API to login, piping that to another API to fetch detailed profile information, and then finally piping that to a function which caches the response in our DB, and each stage accepts a different object type and must be transformed from one to the next as it goes along. RxJava makes this kind of code transformation very readable and easily understandable, but definitely comes with a bit of overhead and isn't right for every situation.

 

Thanks Casey. I was confused about this. Your reply is good.

 

The headline differs much from the question here...

IMO, Kotlin itself can make our life better because it works around most of Java's shortcoming while still providing full interoperation with it.

Classic DEV Post from Oct 31 '19

What Alternative Text Editors Does DEV Use? (Not VS Code 🐱‍👓)

Ankit Kumar profile image
Full Stack Mobile Developer (Android | iOS | React Native | NodeJS) and Blockchain Enthusiast

Customize your DEV feed to keep up with the technologies you care about.

Get Started