I am working on a .NET 3.5 application with slightly complicated behavior. This is for book inventory. To give you an idea, the workflow will be as follows:
- User enters ISBN code
- If the ISBN is valid, check if it exists,
- If it is valid and exists, show information about the book and enable the save button, if not, click the "add book" button
- If this is not valid, show the error
- In the end, the user clicks โsaveโ, so the entry must be saved.
These are four responsibilities:
- Verify ISBN,
- Check the existence of the book,
- Show book info,
- Save the new data about the book.
My question is: should I store the application logic in one MVP structure or should I divide it into four MVP structures, one for each responsibility?
Saving in one MVP structure will be
- make the model more complex
- make test setup more complicated (there is a lot of setup code for each test to select the correct validator, returned book, etc., even if they are not used),
- make presentation logic easier to follow
Saving in separate MVP structures will
- simplify the model
- create simpler tests for each lead,
- difficulty in interactions between the presenters (how can I signal to the presenter that the ISBN is valid so that the book data can be indicated?)
I try the first principles of Presenter, so: - Keep the presentation mute (therefore there are no events like "Presenter one validated the ISBN"), - Keep speakers stateless, - Keep models simple (enough)
Anyone have an idea on how best to do this?
source share