基於MVC的優勢Advantages of an MVC-Based Web Application

ASP.NET MVC 框架具備如下優勢: 前端

  • 它很容易經過將應用程序劃分爲模型、 視圖和控制器管理的複雜性。
  • 它不使用視圖狀態或基於服務器的窗體。這使得 MVC 框架特別適合開發人員想要徹底控制應用程序的行爲。
  • 它使用處理 Web 應用程序請求經過單一控制器前端控制器模式。這使您可以設計支持豐富的路由基礎結構的應用程序。更多的信息,請參閱 MSDN 網站上的前端控制器
  • 它爲測試驅動開發 (TDD) 提供了更好的支持。
  • 它很是適合 Web 應用程序支持的大型團隊的開發人員和 Web 設計人員須要高度的控制應用程序的行爲。

 

Web 窗體基於 Web 應用程序的優勢

基於 Web 窗體框架具備如下優勢: express

  • 它支持經過 HTTP,有利於業務線 Web 應用程序開發保留狀態的事件模型。基於 Web 窗體的應用程序提供了許多支持數百個服務器控件的事件。
  • 它使用一種頁面控制器模式,將功能添加到單個頁面。更多的信息,請參閱 MSDN 網站上的頁面控制器
  • 它使用視圖狀態或基於服務器的窗體,可使管理狀態信息更容易。
  • 它很是適合小團隊的 Web 開發人員和設計師們想要利用大量的可用快速開發應用程序的組件。
  • 通常狀況下,它是應用程序開發的複雜程度較低,由於組件 ( Page類、 控件和等等) 緊密集成,而且一般須要更少的代碼比 MVC 模型。

ASP.NET MVC 框架的功能

ASP.NET MVC 框架提供瞭如下功能: api

  • 分離的應用程序任務 (輸入的邏輯、 業務邏輯和 UI 邏輯)、 可測試性和測試驅動開發 (TDD) 在默認狀況下。在 MVC 框架中的全部核心合同是基於接口的能夠測試經過使用 mock 對象,是模仿實際應用程序中的對象的行爲的模擬的對象。你能夠單元測試應用程序而無需運行控制器在 ASP.NET 進程,這使得單元測試既快速又靈活。你可使用任何與.NET 框架兼容的單元測試框架。
  • 可擴展和可插入的框架。ASP.NET MVC 框架的組件設計以便他們能夠方便地更換或自定義。您能夠插入本身的視圖引擎、 URL 路由策略、 操做方法參數序列化以及其餘組件。ASP.NET MVC 框架還支持使用依賴注入 (DI) 和控制反轉 (IOC) 容器模型。DI 容許您對象注入一個類,而不是依靠類來建立對象自己。IOC 指定某個對象是否須要另外一個對象,第一個對象應該從配置文件之類的外部源中獲取第二個對象。這使得測試更容易。
  • 強大的 URL 映射組件,容許您構建的應用程序具備可理解性和可搜索的 Url。Url 沒必要須包括文件擴展名,並旨在支持 URL 命名模式,工做的很好的搜索引擎搜索引擎優化 (SEO) 和具象狀態傳輸 (REST) 處理。
  • 使用現有 ASP.NET 網頁 (.aspx 文件),用戶控件 (.ascx 文件) 和主頁面 (.master 文件) 標記文件中的標記做爲視圖模板的支持。你可使用現有的 ASP.NET 功能與 ASP.NET MVC 框架中,如嵌套母版頁,線在表達式 (< %= %>),聲明服務器控件、 模板、 數據綁定、 本地化和等等。
  • 對現有的 ASP.NET 功能的支持。ASP.NET MVC 容許您使用窗體身份驗證和 Windows 身份驗證、 URL 受權、 會員和角色、 輸出和數據緩存、 會話和配置文件的狀態管理、 健康監測、 配置系統和提供程序體系結構的功能。

這篇文章最初建立於 2009 年 1 月 27 日 緩存


原文: 服務器

Advantages of an MVC-Based Web Application

The ASP.NET MVC framework offers the following advantages: session

  • It makes it easier to manage complexity by dividing an application into the model, the view, and the controller.
  • It does not use view state or server-based forms. This makes the MVC framework ideal for developers who want full control over the behavior of an application.
  • It uses a Front Controller pattern that processes Web application requests through a single controller. This enables you to design an application that supports a rich routing infrastructure. For more information, seeFront Controller on the MSDN Web site.
  • It provides better support for test-driven development (TDD).
  • It works well for Web applications that are supported by large teams of developers and Web designers who need a high degree of control over the application behavior.

 

Advantages of a Web Forms-Based Web Application

The Web Forms-based framework offers the following advantages: app

  • It supports an event model that preserves state over HTTP, which benefits line-of-business Web application development. The Web Forms-based application provides dozens of events that are supported in hundreds of server controls.
  • It uses a Page Controller pattern that adds functionality to individual pages. For more information, see Page Controller on the MSDN Web site.
  • It uses view state or server-based forms, which can make managing state information easier.
  • It works well for small teams of Web developers and designers who want to take advantage of the large number of components available for rapid application development.
  • In general, it is less complex for application development, because the components (the Page class, controls, and so on) are tightly integrated and usually require less code than the MVC model.

Features of the ASP.NET MVC Framework

The ASP.NET MVC framework provides the following features: 框架

  • Separation of application tasks (input logic, business logic, and UI logic), testability, and test-driven development (TDD) by default. All core contracts in the MVC framework are interface-based and can be tested by using mock objects, which are simulated objects that imitate the behavior of actual objects in the application. You can unit-test the application without having to run the controllers in an ASP.NET process, which makes unit testing fast and flexible. You can use any unit-testing framework that is compatible with the .NET Framework.
  • An extensible and pluggable framework. The components of the ASP.NET MVC framework are designed so that they can be easily replaced or customized. You can plug in your own view engine, URL routing policy, action-method parameter serialization, and other components. The ASP.NET MVC framework also supports the use of Dependency Injection (DI) and Inversion of Control (IOC) container models. DI allows you to inject objects into a class, instead of relying on the class to create the object itself. IOC specifies that if an object requires another object, the first objects should get the second object from an outside source such as a configuration file. This makes testing easier.
  • A powerful URL-mapping component that lets you build applications that have comprehensible and searchable URLs. URLs do not have to include file-name extensions, and are designed to support URL naming patterns that work well for search engine optimization (SEO) and representational state transfer (REST) addressing.
  • Support for using the markup in existing ASP.NET page (.aspx files), user control (.ascx files), and master page (.master files) markup files as view templates. You can use existing ASP.NET features with the ASP.NET MVC framework, such as nested master pages, in-line expressions (<%= %>), declarative server controls, templates, data-binding, localization, and so on.
  • Support for existing ASP.NET features. ASP.NET MVC lets you use features such as forms authentication and Windows authentication, URL authorization, membership and roles, output and data caching, session and profile state management, health monitoring, the configuration system, and the provider architecture.

This article was originally created on January 27, 2009 less

相關文章
相關標籤/搜索