-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
UseCase for each method of repository? #227
Comments
why no one answer ?. i am also interested in this |
ok, let's summarize, I see 2 versions
use Interactor & Presenter & View
cons
perform call from presentation layer to domain layer directly
cons
currently I think of creation of interface like this for synchronos simple actions
it will remove direct calls from Activity/Fragment to Repositopy currently I am not sure which way is right and it'll be good if someone correct me |
@chanhoncongian I'll ask on SO, meaby somebody will answer |
Hi guys, eventually I came across this issue. |
I think we (developers) shouldn't think like this. We don't know how long each repository method would be executing. And there is the answer. Each repository method must be executed asynchronously. We can write UseCase for this or invoke repository method directly but without blocking main thread. |
Does we need to create UseCases for each method from Repository interface in domain layer?
For example assume that I have such Repository interface
As you can see there is
size()
method that returns number of records in database or in file, whatever. And this method is pretty fast.I guess that there is no need for UseCase for this method because it wouldn't block UI thread and can be executed synchronously.
So could you explain me when you create UseCases and when you don't. Basically is there any rules for UseCase creation?
Sorry if there is some misunderstanding in this issue.
The text was updated successfully, but these errors were encountered: