The MVC Pattern

  • Freeman A
N/ACitations
Citations of this article
5Readers
Mendeley users who have this article in their library.
Get full text

Abstract

In Chapter 7 we are going to start building a more complex ASP.NET MVC example. Before we start digging into the details of the ASP.NET MVC Framework, we want to make sure you are familiar with the MVC design pattern and the thinking behind it. In this chapter, we describe the following: • The MVC architecture pattern • Domain models and repositories • Creating loosely coupled systems using dependency injection (DI) • The basics of automated testing You might already be familiar with some of the ideas and conventions we discuss in this chapter, especially if you have done advanced ASP.NET or C# development. If not, we encourage you to read this chapter carefully-a good understanding of what lies behind MVC can help put the features of the framework into context as we continue through the book. The History of MVC The term model-view-controller has been in use since the late 1970s and arose from the Smalltalk project at Xerox PARC where it was conceived as a way to organize some early GUI applications. Some of the fine detail of the original MVC pattern was tied to Smalltalk-specific concepts, such as screens and tools, but the broader concepts are still applicable to applications-and they are especially well suited to Web applications. Interactions with an MVC application follow a natural cycle of user actions and view updates, where the view is assumed to be stateless. This fits nicely with the HTTP requests and responses that underpin a Web application. Further, MVC forces a separation of concerns-the domain model and controller logic is decoupled from the user interface. In a Web application, this means that the mess of HTML is kept apart from the rest of the application, which makes maintenance and testing simpler and easier. It was Ruby on Rails that led to renewed mainstream interest in MVC and it remains the poster child for the MVC pattern. Many other MVC frameworks have since emerged and demonstrated the benefits of MVC-including, of course, ASP.NET MVC. Understanding the MVC Pattern In high-level terms, the MVC pattern means that an MVC application will be split into at least three pieces: A. Freeman, Pro ASP.NET MVC 4

Cite

CITATION STYLE

APA

Freeman, A. (2013). The MVC Pattern. In Pro ASP.NET MVC 5 (pp. 51–66). Apress. https://doi.org/10.1007/978-1-4302-6530-6_3

Register to see more suggestions

Mendeley helps you to discover research relevant for your work.

Already have an account?

Save time finding and organizing research with Mendeley

Sign up for free