2

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.

  1. 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.

  2. Search criteria -> Contains DataList control to display the readonly search criteria by subscribing to search event.

  3. 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?

  • I'm not much into MVP jargon, so I am unsure about what you are calling a "user control". Since there is visually a single search screen, I would think there is a single view/presenter, even if there may be several ways to "handle" the query inside the model. What am I missing there ? – Arthur Havlicek Apr 4 '14 at 9:38
  • User control is a ASP.NET term I believe. It refers to a single "element" in a page like a button or a form - in this case they seem to have built a set of 3 user controls - the search form, the search criteria datalist and the search results table... – Nikhil Apr 28 '14 at 8:49
  • Yes, it is each separate component interms of Ui and functionality. – Sunny Apr 30 '14 at 1:40
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.