These are your options:
var cvp = new ContactViewPresenter(new ContactView());
ContactViewPresenter
constructor sets this.view = viewParam
, and sets this.view.presenter = this
.
It keeps the code in the Presenter, it can swap out views if necessary, and it could pass in a mock of the view for testing.
var cv = new ContactView(new ContactViewPresenter());
ContactView
constructor sets this.presenter = cvpParam
, and this.presenter.view = this
.
Some logic in View, but not a lot. Can swap out presenter if necessary.
ContactView cv = new ContactView();
ContactViewPresenter cvp = new ContactViewPresenter();
cv.presenter = cvp;
cvp.view = cv;
cv.init();
cvp.init();
This is a lot more code.
ContactViewPresenter cvp = new ContactViewPresenter();
Constructor creates sets this.view = new ContactView()
and this.view.presenter = this
.
ContactView cv = new ContactView();
Constructor sets this.presenter = new ContactViewPresenter()
and this.presenter.view = this
The last two seem a bit too coupled.
One is nice in that the code stays in the Presenter, and seems to allow for easier testing.
Two is nice in that you don't have to care about the Presenters too much and can worry about your Views more.