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

UseCase problem? #61

Closed
xudshen opened this issue Oct 25, 2015 · 1 comment
Closed

UseCase problem? #61

xudshen opened this issue Oct 25, 2015 · 1 comment

Comments

@xudshen
Copy link

xudshen commented Oct 25, 2015

Hi, I'm recently working on my android project code refactoring and I find your project.

I'm confused about using UseCase class which will be @Inject in Presentation Layer to get the data in Data Layer.
Will this be more convenient if we just @Inject the UserRepository in Presentation Layer directly, since UseCase(GetUserDetails) is just some kind of wrapping of UserRepository from my point of view.

Like this:

class UserDetailsPresenter{
    private UserRepository userRepository;
    ...
    @Inject
    public UserDetailsPresenter(UserRepository userRepository){
        ...
    }    
    ...
    //get the user detail
    userRepository.user(this.userId).subscribeOn(...).observeOn(...).subscribe((data)->{});
    ....
}
@caseykulm
Copy link

For something that simple, yes it does appear to work. However as your data sets get more complicated, a UseCase can encompass combining multiple elements from the repository, and explicitly having this layer define what repository elements create a UseCase is supposed to help it scale as necessary.

@xudshen xudshen closed this as completed Nov 11, 2015
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

2 participants