13.2. Why MVC?

MVC is about dividing up your applications. This separation of concerns has a number of advantages:

  • Division/testability: Traditionally, ASP.NET web applications were difficult to test because ASPX and ASCX controls often ended up containing code related to user interface and business logic. In ASP.NET, MVC classes called controllers manage the interaction between the UI and data (model). This separation also makes it much easier to write tests for your application. You can test controller classes directly instead of having to create complex ways of simulating ASP.NET's UI.

  • Flexibility: Because all the layers are decoupled, it should be easy to swap out any individual layer without affecting the others. The ASP.NET MVC framework is very flexible and allows customization of many components. Perhaps you want to change your UI/view or use a different database?

  • Maintainability: Although ASP.NET MVC is inherently customizable, it enforces a project to be constructed in a specific way and can help keep an application's code tidy. Additionally, because the project structure is relatively rigid, new developers arriving on the team should be able to quickly understand its architecture.

MVC is a lean, mean fighting machine; it doesn't contain much ASP.NET functionality. This makes it quick (no parsing or sending of viewstate information), and it also means no interference with rendered HTML. This makes MVC a great choice for high-volume web sites or where complete control over rendered HTML is vital.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.204.241