koufa
11/13/2019, 10:34 PMAnastasia Finogenova
11/13/2019, 11:12 PMtschuchort
11/13/2019, 11:49 PMAnastasia Finogenova
11/14/2019, 12:11 AMPablichjenkov
11/14/2019, 12:19 AMResource
I name it Event
. I also move the constructor fields from the base class to the subclasses. I don't use it with generic since I create one inner Event class per remote resource class. Maybe generics make it a clearer design.ghedeon
11/14/2019, 12:23 AMLoading
in Result always felt like a very poor decision.Anastasia Finogenova
11/14/2019, 2:37 AMdino9
11/14/2019, 7:03 AMkoufa
11/14/2019, 7:58 AMResult
type or the Resource
from Google ( but without loading etc).koufa
11/14/2019, 7:59 AMViewModel
---> UseCase
---> Repository
and then Repository
returns type Result
I may have to use a when
statement in UseCase then do my actions and return a new Result
object and maybe use also when
statement in ViewModel. Seems a little bit too much "when" overhead. This could be mitigated though by writing extensions methods.ghedeon
11/14/2019, 8:46 AMResult
with exceptions that are wrapped in some sort of domain Error
. What's left is handling, probably in ViewModel
and generating success/error state for the view.koufa
11/14/2019, 9:44 AMGetUserMovieListUseCase
that combines data from 2 Repositories like: UserRepository
and MoviesRepository
where both of them return their data wrapped in some Result
type. Then you have to check them both to combine them in a new `Result`type.ghedeon
11/14/2019, 10:25 AMTry again
button. So, at least in my case, the when
statement stays pretty lean and doesn't bother me much.Pablichjenkov
11/14/2019, 3:28 PMwhen
is fine. Is the way. Think of it as a discontinuous function in math.