Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET MVC - Reasons to begin

I'm thinking about going into the ASP.NET MVC scene.

I've seen the videos at http://asp.net/learn, but they havn't impressed me.

So can you answer me, what makes MVC "so impressive", and why does it make life better and easier?

like image 295
Manain Avatar asked Feb 28 '23 22:02

Manain


2 Answers

ASP.NET MVC is much more in tune with the technology on which it is layered. ASP.NET Forms attempted to pretend that there was a nice fat stateful infrastucture as there is in a standard WinForms app. However HTTP and Web servers do not like fat stateful applications.

ASP.NET MVC allows for a separation of concerns. The request is processed by a controller not a "Web Page", it chooses how to respond and what UI is needed to present that response. The controller builds the set of structured data needed by its choice of view then hands over that data to the view.

This division allows much easier testing, the view is merely a means to present what should be a complete well munged chunk of data. Its way easier to build a test for something which takes structured data in and responds with structured data.

ASP.NET Forms is almost impossible to test in this way (especially without expensive tools claiming to achieve it). Hence an MVC application is easier to get right and much easier to ensure it stays right by consistently running existing tests.

Caveat: The major draw back of ASP.NET MVC right now is lack of solid documentation. I've been assured that docs are coming "soon".

like image 144
AnthonyWJones Avatar answered Mar 05 '23 17:03

AnthonyWJones


Have you ever worked on a large project that had great intentions when it started but 3 years later was a complete mess?

MVC is a just pattern it can be misused the same as ASP.NET is misused. It is just harder to do.

Model–View–Controller (MVC) is an architectural pattern used in software engineering. Successful use of the pattern isolates business logic from user interface considerations, resulting in an application where it is easier to modify either the visual appearance of the application or the underlying business rules without affecting the other.

It allows you to separate your logic in a way that makes sense to most people. While at the same time it lends itself well to testing.

like image 30
cgreeno Avatar answered Mar 05 '23 16:03

cgreeno