Web application 要不要 MVC ?(100分)

Y

yysun

Unregistered / Unconfirmed
GUEST, unregistred user!
这几天开始做 .NET,看了一些材料和演示,觉得与 J2EE 不同的是.NET 根本不重视 MVC。
下面这段话,摘自 http://www.gotdotnet.com/team/compare/petshopfaq.aspx
基本上代表了 .NET 的观点:
Whydo
esn't the .NET Pet Shop Use a Model View Controller (MVC) Architecture?
Our blueprintdo
es not implement Model-View-Controller (MVC) architecture because we believe the MVC architecture of the J2EE Java Pet Store leads to a non-optimal design for this application. The MVC design pattern separates the data representation from presentation (separating a Model from its View) and separates the application behavior from the data representation (separating a Controller from the Model). For an overview of the MVC design pattern please refer to http://java.sun.com/blueprints/patterns/j2ee_patterns/model_view_controller/index.html.
In general, the MVC architecture is meant to achieve the following benefits:
-Separating data representation from presentation (or separating the Model from the View) allows multiple data presentations for the same data. Changes can occur in both the Model and View components (their interface must remain the same), allowing for maintainability, extensibility, and testability.
-Separating application behavior from the data representation (or separating the Controller from the Model) allows the users requests to be mapped from the Controller to specific application level functions in the Model.
The .NET Pet Shop uses a light-weight componentized design, and achieves essentially the same benefits with much less code required. The result is a more streamlined application that is both easier to create and easier to maintain over time. Also, the performance of this architecture is much improved over the MVC architecture of Java Pet Store according to our tests.
我现在就开始怀疑:Web application 要不要 MVC ?
 

一个过客

Unregistered / Unconfirmed
GUEST, unregistred user!
M$说得对
 

四库全书

Unregistered / Unconfirmed
GUEST, unregistred user!
孙老师准备用。net改写大富翁的哪些东西呢?
 

曹晓钢

Unregistered / Unconfirmed
GUEST, unregistred user!
本来MVC就是一个学术上的观点。MS就算不用标准的MVC, The .NET Pet Shop uses a light-weight componentized design
这个light-weight componentized design也一定是一个MVC模型的改良模型。
 
Y

yysun

Unregistered / Unconfirmed
GUEST, unregistred user!
曹晓钢, 还记得我试验的 Bean - Factory - Adpapter 结构吗?
拿到公司项目去试验,最后被“优化”为:一个通用的 DBFactory,
它包含函数 string loadBySqltoXml(string sql);
(sql 可以执行 stored procedure)
直接用 SQL Server 2000 的 XML 功能丛数据库提取 XML 数据,用 XSL 转换到网页。
这样的 Web app,通用性、扩展性都受到限制,但是运行效率提高10-20倍(很可观的)
最新的 Pet Shop 测试, MS 声称 .NET 比 J2EE 快 10 倍,我有点相信了。
http://www.gotdotnet.com/team/compare/veritest.aspx
Sun 说 Pet Shop 用来做性能测试是不对的,因为它并没有做性能“优化”,
那么如何优化?把那些 Bean Home class 砍掉?
这倒有让我想起另外一个问题,Sun 大力推荐 swing,这套东西可是结构庞大、
四平八稳、考虑了各种兼容性、真是集复杂性的大成。
直到有一天我们看到了 IBM 在 Eclipse 中使用的 SWT,直接把 WinApi 和 Java
连接起来,界面效果和速度都是一个大跃进。
比较两者让人有似乎被蒙蔽了的感觉。
 
L

LitterTiger

Unregistered / Unconfirmed
GUEST, unregistred user!
哪里有介绍mvc思想的资料?最好中文
 

曹晓钢

Unregistered / Unconfirmed
GUEST, unregistred user!
上次我翻的Struts用户指南在这里:
http://61.155.107.187/pub/doc/Struts/userGuide_CN/

 
L

LitterTiger

Unregistered / Unconfirmed
GUEST, unregistred user!
稍微明白了点mvc了,原来和mfc的文档视图结构差不多,
xml好象也是这个思想
仔细 想想,也不一定要用他,vcl没有他,不也很好,他与组件化思想不容
不可否认mvc可扩展等方面很好
 

左轻侯

Unregistered / Unconfirmed
GUEST, unregistred user!
看来以后上来要先搜yysun的贴子了:)
web app和Desktop app不同,MVC好象是绕不过去的问题
除非XML+XSL成为主流……
 
Y

yysun

Unregistered / Unconfirmed
GUEST, unregistred user!
MVC 不完全是学术性的东西,已经是 J2EE 的基石和招牌。
.NET 下也是有可能想 J2EE 那样做 MVC 的,比如用 ISAPI Filter 做控制器,
C# class 处理业务逻辑,Web control 和 code behind 做显示界面。
但是 MS 对此留了一手,并没有进军这个方向。
实际上 MS 是 MVC 的老手,整个 MFC 就是标准的 MVC 结构。
OWL - VCL - CLX 不是 MVC,也许 Delphi C# 之父那帮人(Anders Hejlsberg)
不认为 MVC 很有必要,目前并在 MS 占据了上风。
 
Y

yysun

Unregistered / Unconfirmed
GUEST, unregistred user!
web app 估计 XML + XSL 不会成为成为主流了 [:(]
我原指望通过 XML + XSL 分离数据处理和显示处理。
但是,通过在目前我从事的项目中的实验结果,发现 XSL 带来了:
1、技能复杂性,除需要 HTML 以外,developer 还需要 XSL 经验,并且没有好的 IDE。
2、结构复杂性,增加了一层,Debug 复杂化了,必须先确定 XML/XSL 哪个有问题。
3、效率下降,因为 XSL 是通用的处理器,象正则表达式,越是通用越是效率低。
如果是服务器端做 XSL 解析: ASP->XML->MSXML->HTML,大概比 ASP->HML 慢了3-4倍。
有这么多弱点,抵消了很多 XSL 的优势,所以我估计:XML + XSL 不会成为成为主流。
我们的项目最后还是决定用服务器端做 XSL 解析,因为有 fully customizable Skin 的
需求,别无选择,最后使用了 SQL Server 2000 的 Template 和 XML 功能加上做了 XSL cache,
提高了XSL 效率,所以服务器端做 XSL 解析还是可行的(只是因为复杂,而不主流)。
MVC 会不会也因为复杂,也不主流了?或不被作为首选结构了?
题外:我一直相信客户端 XSL,大富翁就是个例子,为此不惜牺牲对 Netscape 的支持。
今天试验发现 Mozilla 1.0 客户端 XSL 很好,运行大富翁的 XML/XSL 应该没有问题,
所以,大受鼓舞。 http://www.delphibbs.com/delphibbs/dispq.asp?lid=1153200
 
L

LitterTiger

Unregistered / Unconfirmed
GUEST, unregistred user!
恕我直言,练功场好象说的比做的多
 
Q

qdyoung

Unregistered / Unconfirmed
GUEST, unregistred user!
apache的cocoon做的服务器端解析很快,因为"cache"算法完全不同,有点类似于jsp
编译到java代码再运行,以后每次都直接运行java代码,cocoon把xsl引擎编译
--
http://www.8421.org
 
Y

yysun

Unregistered / Unconfirmed
GUEST, unregistred user!
qdyoung, 讲的东西叫 XSLTC: 它把 XSL 直接生成 .class 文件,称为 translet
(与 JSP 翻译成 Servlet .java 再编译成 .class 不同)
http://xml.apache.org/xalan-j/xsltc_usage.html
其中用到了 The Byte Code Engineering Library (formerly known as JavaClass)
http://jakarta.apache.org/bcel/index.html
我的观点:XSLT 只是因为复杂,而不主流。
 

老人家

Unregistered / Unconfirmed
GUEST, unregistred user!
http://www.huihoo.com/java/struts/
http://www.kupage.com/webdesign/8/20031210/1604270000027c0gudup.htm
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
3K
import
I
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
724
import
I
顶部