Pro Asp.Net MVC 3 Chapter 1 整理笔记

Notice that we’re referred to MVC as a pattern for the User Interface.请注意 我们吧MVC作为一个用户接口的模式。

Pro Asp.Net MVC 3 Chapter 1 整理笔记

约定胜于配置

不要重复你自己

尝试更有效的方法,如果可以,抛弃你的程序员的方式

asp.net Web Form 的几点不足:

1.View State weight: The actual mechanism for maintaining state across requests
(known as View State) results in large blocks of data being transferred between the
client and server. This data can reach hundreds of kilobytes in even modest web
applications, and it goes back and forth with every request, frustrating site visitors
with slower response times and increasing the bandwidth demands of the server 重量级的View state

2 Page life cycle: The mechanism for connecting client-side events with server-side
event handler code, part of the page life cycle, can be extraordinarily complicated
and delicate. Few developers have success manipulating the control hierarchy at
runtime without getting View State errors or finding that some event handlers
mysteriously fail to execute.  复杂的页面生命周期

3.False sense of separation of concerns: ASP.NET’s code-behind model provides a
means to take application code out of its HTML markup and into a separate codebehind
class. This has been widely applauded for separating logic and
presentation, but in reality, developers are encouraged to mix presentation code
(for example, manipulating the server-side control tree) with their application
logic (for example, manipulating database data) in these same monstrous codebehind
classes. The end result can be fragile and unintelligible. 对于关注点分离的支持力度不够

4.Limited control over HTML: Server controls render themselves as HTML, but not
necessarily the HTML you want. Prior to ASP.NET 4, the HTML output usually
failed to comply with web standards or make good use of Cascading Style Sheets
(CSS), and server controls generated unpredictable and complex ID values that are
hard to access using JavaScript. These problems are reduced in ASP.NET 4, but it
can still be tricky to get the HTML you expect. 对于HTML的直接操作存在不足

,服务器端控件会生成复杂的HTML标记

5.Leaky abstraction: Web Forms tries to hide away HTML and HTTP wherever
possible. As you try to implement custom behaviors, you frequently fall out of the
abstraction, which forces you to reverse-engineer the postback event mechanism
or perform obtuse acts to make it generate the desired HTML. Plus, all this
abstraction can act as a frustrating barrier for competent web developers.

对于抽象的支持不足,只是存在Code Behind

6.Low testability: The designers of ASP.NET could not have anticipated that
automated testing would become an essential component of software
development. Not surprisingly, the tightly coupled architecture they designed is
unsuitable for unit testing. Integration testing can be a challenge, too.

可测实行不足。

软件设计要遵循可测试性、可扩展性、对内封闭 对外开放、易读性

我又回来了,回到了技术最前线,
上一篇:现在要搞清楚的知识点


下一篇:asp.net MVC3 Helpers Partial RenderPartial Action RenderAction