I'm not shure 开发者_JAVA技巧if I realy understood MVP in the context of composition. Lets say I've got a MainView which is a composite of ViewA and ViewB.
I've seen several examples where the View creates the presenter. Now here's my Problem, i'm not realy shure who should create whom.
Should the MainView create the MainPresenter which is a composite of APresenter and BPresenter, or should each view create its own presenter.
If MainView is just a container for both ViewA and ViewB, then it does not need its own presenter, and the sub-views can continue using their individual default presenters.
However, if the MainView also modifies the sub-views behavior, it needs to create a composite presenter and inject it for the sub-views to use instead of their default presenters.
精彩评论