Notice that we’re referred to MVC as a pattern for the User Interface.请注意 我们吧MVC作为一个用户接口的模式。
约定胜于配置
不要重复你自己
尝试更有效的方法,如果可以,抛弃你的程序员的方式
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 theclient and server. This data can reach hundreds of kilobytes in even modest webapplications, and it goes back and forth with every request, frustrating site visitorswith slower response times and increasing the bandwidth demands of the server 重量级的View state2 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 complicatedand delicate. Few developers have success manipulating the control hierarchy atruntime without getting View State errors or finding that some event handlersmysteriously 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 codebehindclass. This has been widely applauded for separating logic andpresentation, but in reality, developers are encouraged to mix presentation code(for example, manipulating the server-side control tree) with their applicationlogic (for example, manipulating database data) in these same monstrous codebehindclasses. 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 usuallyfailed to comply with web standards or make good use of Cascading Style Sheets(CSS), and server controls generated unpredictable and complex ID values that arehard to access using JavaScript. These problems are reduced in ASP.NET 4, but itcan 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 theabstraction, which forces you to reverse-engineer the postback event mechanismor perform obtuse acts to make it generate the desired HTML. Plus, all thisabstraction 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 softwaredevelopment. Not surprisingly, the tightly coupled architecture they designed isunsuitable for unit testing. Integration testing can be a challenge, too.可测实行不足。
软件设计要遵循可测试性、可扩展性、对内封闭 对外开放、易读性