ASP.NET Web forms and MVC are the two major .NET technologies widely used for creation of webpages. Today I’m going to talk a little on this topic.
The Web forms was used since a long time (and is still used). Whereas the MVC specification was launched recently by Microsoft. But Microsoft has stated while launching MVC that:
MVC is not a replacement for Web forms
Because MVC was a more advanced and efficient method of creating websites than the Web forms, it was considered as a replacement for the Web forms. But that’s not true story.I t is true that MVC was a better way to create websites, but still Web forms have not lost their importance. They are still used in places where there is needed extensive use of the server controls that the .NET framework provides.
There are many advantages that MVC have over Web forms:
The first, MVC means Model, View and Controller which means the presentation, logic and database interactions are completely separated. It is known as Separation of Concerns (SoC). In Web forms, everything is tightly bound to each other, so there is actually very less separation. Parallel development can’t be executed in the Web forms (Various developers working together).
Less separation of concerns generally leads to spaghetti code in Web forms pages, because the presentation and logic part are generally written together. In MVC, all three parts are loosely bound to each other. So the code remains legible and can be developed by different programmers.
The second, MVC has a great in-built routing engine which comes very handy for defining your own routes. You can specify your own routes and can even send route values with the request.
Basically, all routes point to some action which do something and return created models to the View part. The view doesn’t know anything about how the model was created, it just knows how to present it to the user. It uses the model to present the data.
It is completely up to the developer to choose which technology he wants to use. When a project needs to be done in less span of time, you can use the Web forms technique because it can be developed quickly, whereas doing the same thing in MVC could use up some more time. Moreover, if you are in team, and most of the members are familiar in developing Web forms then it could be a little hard for to learn MVC. So it entirely depends on the condition you are placed in to choose from the different techniques. I myself have made projects through both the techniques and I found them both interesting to work with.
What’s your opinion? You are always welcome to leave a comment.