Composing a single MVP application from multiple MVP applications
I have two independent winforms applications written in C# where I've used MVP. Now I am about to combine these into one application (also MVP) that have functionality from both but with a new View front-end.
What is best practice:
- Make a super-presenter that combines the presenters of the individual applications into one, or
- make a super-model(!) that combines the two models into one model,开发者_Go百科 and then writing a super-presenter.
What are advantages/disadvantages of the two? Am I even on the right track?
You should leave the models alone and focus on creating the new presenter and view with the combined functionality. From the information in your question focus of the project isn't that the model lack some element but rather they need to work together. The function of the presenter is to make that happen seamlessly.
The most likely issue you will run are any assumption about the presenter that got into the model. It can be hard to keep separation when a model is developed to use one presenter (with associated views). By creating a new presenter you will quickly see if any of these assumption exist which help with maintaining future versions of the original software and the new software.
Aside from this issue this should be relatively straightforward project as it plays into the strengths of MVP. The ability for the developer to change one or more levels without impacting the others.
Unless there is duplication which you are trying to remove your Models shuold be readily combinable.
imo, Models should not change often for resturctureing of applications. They should only change when underlying business changes.
That leaves us with one option.
精彩评论