基于MVC的优点Advantages of an MVC-Based Web Application

ASP.NET MVC 框架具有以下优点:

  • 它很容易通过将应用程序划分为模型、 视图和控制器管理的复杂性。
  • 它不使用视图状态或基于服务器的窗体。这使得 MVC 框架特别适合开发人员想要完全控制应用程序的行为。
  • 它使用处理 Web 应用程序请求通过单一控制器前端控制器模式。这使您能够设计支持丰富的路由基础结构的应用程序。更多的信息,请参阅 MSDN 网站上的前端控制器
  • 它为测试驱动开发 (TDD) 提供了更好的支持。
  • 它非常适合 Web 应用程序支持的大型团队的开发人员和 Web 设计人员需要高度的控制应用程序的行为。

 

Web 窗体基于 Web 应用程序的优点

基于 Web 窗体框架具有以下优点:

  • 它支持通过 HTTP,有利于业务线 Web 应用程序开发保留状态的事件模型。基于 Web 窗体的应用程序提供了许多支持数百个服务器控件的事件。
  • 它使用一种页面控制器模式,将功能添加到单个页面。更多的信息,请参阅 MSDN 网站上的页面控制器
  • 它使用视图状态或基于服务器的窗体,可以使管理状态信息更容易。
  • 它非常适合小团队的 Web 开发人员和设计师们想要利用大量的可用快速开发应用程序的组件。
  • 一般情况下,它是应用程序开发的复杂程度较低,因为组件 ( Page类、 控件和等等) 紧密集成,并且通常需要更少的代码比 MVC 模型。

ASP.NET MVC 框架的功能

ASP.NET MVC 框架提供了以下功能:

  • 分离的应用程序任务 (输入的逻辑、 业务逻辑和 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:

  • 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:

  • 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

转载于:https://my.oschina.net/ind/blog/474042

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值