Chapter 2. Model-View-Controller and ASP.NET

Model-View-Controller (MVC) has been an important architectural pattern in computer science for many years. Originally named Thing-Model-View-Editor in 1979, it was later simplified to Model-View-Controller. It is a powerful and elegant means of separating concerns within an application (for example, separating data access logic from display logic) and applies itself extremely well to web applications. Its explicit separation of concerns does add a small amount of extra complexity to an application's design, but the extraordinary benefits outweigh the extra effort. It has been used in dozens of frameworks since its introduction. You'll find MVC in Java and C++, on Mac and on Windows, and inside literally dozens of frameworks.

Understanding the core concepts of MVC is critical to using it effectively. This chapter discusses the history of the MVC pattern, as well as how it is used in web programming today. You'll also learn some of the limitations of ASP.NET Web Forms and how ASP.NET MVC attempts to release the developer from those limitations.

WHAT IS MODEL-VIEW-CONTROLLER?

Model-View-Controller (MVC) is an architectural pattern used to separate an application into three main aspects:

  • The Model: A set of classes that describes the data you're working with as well as the business rules for how the data can be changed and manipulated

  • The View: The application's user interface (UI)

  • The Controller: A set of classes that handles communication from ...

Get Professional ASP.NET MVC 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.