Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android loaders support #1

Open
ghost opened this issue Oct 9, 2014 · 1 comment
Open

Android loaders support #1

ghost opened this issue Oct 9, 2014 · 1 comment

Comments

@ghost
Copy link

ghost commented Oct 9, 2014

Wow,

This looks very promising and looks like you put great effort into it. I'm not familiar with RxJAva but it looks like you're using it to load data.

What keeps me thinking, is what would happen if we'd like to drop rxjava and use loaders instead. I think that loaders are one of the most encouraged patterns by Google and community, so it'd be really nice to try to follow clean architecture with loaders.

Where does android loaders & loader callbacks belong here? My wild guess would be that they should end up in data package, but on the other hand they depend on ui lifecycle.

@mcharmas
Copy link
Owner

Hi Filip,
glad you find it usefull. To be honest I am not a greatest fan of loaders especially
when I am not deailing directly with ContentProviders - I find them rather buggy and painfull to use.

But let's think where should we use them...
In this example app all UseCases are sync and they are dealing with database, so their execution should be performed in background thread. Loaders are technical detail so they shouldn't be for sure in domain layer, nor in data layer - which should only server data storage implementation. Loaders by design are used to deliver data to UI layer and they are bound with it (LoaderManger is part of Activity) so I would use loaders for sure in UI layer. I don't have direct idea how to plug them into existing codebase without bigger refactor though - it is really strongly bound with activity. If you have any idea how to use them clearly please attach some code as an example.

By the way I recommend you looking at RxJava - it is really amazing tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant