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

Better separation between MVP presenter and view #18

Open
davidschreiber opened this issue Jul 3, 2016 · 1 comment
Open

Better separation between MVP presenter and view #18

davidschreiber opened this issue Jul 3, 2016 · 1 comment

Comments

@davidschreiber
Copy link

davidschreiber commented Jul 3, 2016

In the MVP example the view directly issues commands on the presenter, for example the MainActivity directly calls MainPresenter#loadRepositories whereas it should rather use a passive callback like Presenter#onUsernameSubmitted. The main reason for this is to hand over navigation responsibility to the presenter away from the view (which should be a dumb view).

I've created this issue for discussion, since this is obviously a matter of architecture style and code separation.

@ivacf
Copy link
Owner

ivacf commented Jul 4, 2016

Hi David, I kind of agree with you that presenter methods should be named differently using callback-like name.
However, there is cases where the presenters have to perform an action that hasn't necessarily been triggered by the user. For example, when the activity is created the presenter has to load and present some data. Do you think is better to have a separate method in the presenter like loadData() and call that from Activity.onCreate(), or simply triggering that initial call from the attach(MvpView view) method in the Presenter?

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