Architectural patterns are important for defining the basic structure of a web application based on any technology. In ASP.NET development process, very often MVC pattern is adopted by the developers to develop a reliable and easily scalable application. The developers often pay less attention to understand the application and selecting a right architectural pattern for it. More often, they are seen to go for MVC which they think to be the most suitable and right architectural solution for development of web applications. But, this does not hold true all the times. There are a few circumstances where other architectural patterns like MVP work much better as compared to the MVC architecture and should therefore be implemented for better web application development. But, for this, it is very important that the developers have a clear knowledge about MVP and its advantages over MVC; only then will they be able to make out between MVC and MVP patterns as better solution for a specific ASP.NET application development.
Following are a few circumstances defined, where MVP could be a more suitable architectural pattern to implement for ASP.NET web applications.
The asp.net based dynamic web applications would have user interface controls that require server side event generation which ultimately would be handled by view. Hence, model-view-controller pattern does not hold good for the standard ASP.NET request processing as in MVC the user inputs would be received by controller first. Hence, using MVC for conventional server-side event generating models would be a foolish thing to do. Here, a better way would be to get user input directly to the view instead of controller being the receive point for the user inputs. This would be possible with MVP or Model View Presenter pattern only. In MVP pattern, the user inputs are received by the view and then sent to the controller or presenter for formatting. This scheme works well with most of the UI libraries of ASP.NET. Hence, if a desired UI library relies on server-side event model, then MVP pattern is good to use.
In MVP pattern, the presenter and view are tightly linked with each other. Presenter can access its view at any time by setting or getting its properties. On other hand, MVC provides limited communication between view and controller, where all the data to the view has to be passed only in a single call. Hence, if an application required more communication between controller and view, then MVP would be a better to go for.
MVP is compatible with various UI platforms which is not the case with MVC pattern that is said to support only the Windows Forms and ASP.NET Web Forms. The MVC pattern suits best for development of web applications but does not support any other type of presentations or UI platforms. Hence, if an application has to be developed to support various UI platforms, then it is better to opt for MVP architectural pattern.
Hence, Model-View-Presenter could be an ideal architectural pattern choice for ASP.NET web applications in various scenarios as above. So, the .NET developers are advised to consider using MVP patterns over MVC for ASP.NET development in above circumstances for better web development.