We are working on ASP.NET webforms application developed using WCSF (MVP pattern). In the application, there is a search screen that allows the user to enter some fields and display the results.
We have segregated the functionality into user controls and each user control has its own view and presenter.
-
Search -> It consists of search fields along with submit button. It contains validations inside the presenter. After the page is validated, it raises the custom event.
-
Search criteria -> Contains DataList control to display the readonly search criteria by subscribing to search event.
-
Search results -> Communicates with controller and binds the grid by subscribing to search event. It also contains sorting and all grid related events.
Since each control has its own controls and behavior following SOLID principles, views and presenters are thin and testable. Also, it increased the productivity by facilitating developers to be able to work on tasks independently.
But on the other end, we are thinking whether we over-engineered and increased the complexity by introducing the user controls, custom events, etc. for this simple functionality?
3
I would suggest giving the links contained in this post by Martin Fowler a read. My personal experience with MVP has been in an Android application as well as some Game development within the Unity3D engine. I’m a big fan of this pattern as it’s managed to allow me to solve some interesting problems, but I’ve also learned to be weary of trying to slap some single golden rule on how to approach it.
Martin Fowler stated in one of the articles that using the Supervising Controller as well as the Passive View pattern would likely be an investigation into the specific problem and deciding on which of the two or even what combination of the two patterns solve the problem the best. For now it does seem that the solution was over engineered a little, but if the pieces of functionality can stand alone and function alone there shouldn’t be too big a problem. I’d even leave it as is and address whether it’s too complex once you actually start seeing issues around the complexity.