Why is ASP.NET MVC so Popular?

Classic ASP.NET

ASP.NET MVC has become more and more popular. Why? The ordinary ASP.NET allows developers to abstract from many details like request/response headers (by wrapping everything in nice API), manual HTML coding (by using server-side controls), etc. Everything is really cool – we develop a Web site for seconds. But what about the maintainability of this site later? Customers always want more and more. Even after years they may ask you to implement a new feature for them. And then developers start to sink into the depth of their own code ocean. If we add the lack of good documentation, the entire situation becomes really bad.

MVC

MVC stands for Model-View-Controller. Martin Fowler has a great post on GUI architectures.

The principles of MVC are really simple. The View contains the presentation (HTML, CSS, JavaScript). It may also contain little presentation logic like showing and hiding elements, etc. The Controller is responsible for dealing with user requests. It gets requests and uses a corresponding View to render the data. It is also responsible for validating user input. The Model is the gap between the Controller and the View. It contains the data to be shown on the View. It may take the form of a simple ViewModel (just data holder without any business logic) to a business object.

Why MVC?

MVC adds something developers need – discipline! Discipline in writing and structuring code. After a product conforming to MVC is made, everyone who is familiar with this pattern can easily get into the source code. I am a strong follower of the principle convention over configuration and MVC complies with it. Not only separation of concerns, better testability, but it also brings easier maintainability.