3

mann... either i am dumb or my team is a bunch of excited monkeys.

for last 6 months my senior and this contract dev (both in Android) have been fussing about adding coroutine flows in our codebase: how our codebase "needs" it and how flows will help our codebase become "better"

when i asked them why, they gave me even more shit about hot flows cold flows, state flows, and how ots the latest "solution" from google.

So today, while going through another existential crises in my free time, i decided to understand what these "flows" are.

and from what i understand, it is mainly for cases in which there os actively changing data and we want to get latest updates without any event or trigger, like those streaming datas , chat messages, location etc.

but we are a freaking insurance app! user presses a button and we make an api call! what is the fucking problem here that isn't being solved by good old livedata and coroutines? There isn't any "live" api in app as far as i know and even if there is the code should be modified for 1 such api.

why fuck the whole codebase for a usecase that isn't applicable for 99% of APIs?

also, if a flow is going to auto trigger and call api, how are we supposed to control it? like say there is a offers api(there isn't) which gives us the latest offer products to show user for 5 seconds then refresh. for this i will simply returrn

flow{

while(true){
emit (offer api results)
delay(5000)
}

}

but this is an infinite polling api! how to stop it when say user pressed a cross button or did some other interaction?

it seems useless as fuck.. i can achieve a more controllable polling using the same while loop in different location or some other solution that won't require me adding this wierd api

Comments
  • 0
    Why should polling stuff change? Anyway, it'll always be some kinda polling thingy but maybe you won't see it. Use case for async stuff is indeed low. I think for most things it won't make sense at all
  • 1
    @retoor polling responses changes with time , that's the whole point of polling , right? for eg you are observing the google location api while traveling in a car, its returning your location based on that instance of time, thus the response changes
  • 1
    @dotenvironment true, but you'll keep polling, also with coroutines. They doing nothing else than polling technically
  • 1
    @retoor yes exactly!
    I don't understand why tthis feature is being hyped so much
  • 1
    @dotenvironment exactly! Let's add everywhere hidden polling where it's not needed. So easy... Your codebase quality will go down probably with inconsistent coroutine stuff
Add Comment