MVC 架构最先进吗?

发布于 2024-09-06 23:38:09 字数 173 浏览 6 评论 0原文

似乎有大量可能的 MVC 配置/架构(MVC、MVVM、MVP、HMVC、PAC、文档视图...)。目前是否有公认的“最佳”或最先进的 MVC 架构?最新的想法是什么?或者这一切都是免费的和/或简单地与开发平台相关(例如 WPF 的 MVVM)?

(具体来说,我对应用于桌面/富客户端应用程序的 MVC 感兴趣。)

Seems like there are a ton of possible MVC configurations/architectures (MVC, MVVM, MVP, HMVC, PAC, document-view...). Is there any currently accepted 'best' or state-of-the-art MVC architecture? What is the newest thinking? Or is it all a free-for-all and/or simply tied to whichever platform one develops on (e.g. MVVM for WPF)?

(Specifically I'm interested in MVC as applied in desktop/rich-client applications.)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

黯然#的苍凉 2024-09-13 23:38:09

不。您不会就什么是“当前接受的”最佳架构达成任何一致。

这当然不是 MVC 或 MVP。这些架构分别起源于 70 年代末和 90 年代初。 MVP 是 MVC 的改进,但在 MVP 发明的二十年里,我们已经清楚地发现它存在很多很多缺陷。这就是为什么有这么多新的竞争架构。

“模型”和“视图”的概念已被广泛接受,并且似乎对于当今所有当前的架构模型来说都是通用的。真正的问题是如何最好地将它们联系在一起。除了模型和视图之外,您还需要其他东西,但是什么呢?

大多数较新的体系结构倾向于通过使用数据绑定、表达式或类似机制将视图链接或直接绑定到模型和“其他东西”来实现此目的。这样,模型中可以直接由视图绑定的任何内容都不需要涉及“其他内容”。

我个人最喜欢的是 MVVM。我喜欢这样一个事实:“视图模型”在概念上只是一个“模型”,具有任何其他模型的所有方面,只是它(通常)不会被写入磁盘。事实上,如果不造成混淆,“MVVM”可以重命名为“MV”,因为它几乎不需要视图和模型之外的任何其他东西。 MVVM 不仅可以与 WPF 一起使用,还可以与任何具有高级数据绑定功能的演示框架一起使用。不幸的是,这不包括 GWT 和 Cocoa。我还喜欢 MVVM,因为它倾向于完全消除冗余或重复的代码。

MVVM 并不是镇上唯一的高级玩家。基于传统模型和视图的面向方面的方法和命令架构也有类似的愿望。

底线是,这仍然是一个积极研究的领域,目前尚未达成共识。 MVVM 是最流行的新架构,但不是唯一的一种。陪审团还没有定论。

注意:要了解新架构如何相对于 MVC 和 MVP 进行改进,请查看 Cocoa 和 WPF 的比较从标题“重复代码”开始一直到“命令架构”部分的末尾。

No. You will not get any agreement on what is the "currently accepted" best architecture.

It is certainly not MVC or MVP. These architectures originated in the late 70s and early 90s respectively. MVP is an improvement on MVC, but in the twenty years since MVP was invented, it has become clear that it suffers from many, many flaws. This is why there are so many new competing architectures.

The concepts of "model" and "view" are well-accepted and seem to be common to all current architecture models nowadays. The real question is how to best link them together. You need something else in addition to the model and view, but what?

Most of the newer architectures tend to do this by having the view link or bind directly to the model and the "something else" using data-binding, expressions, or similar mechanisms. That way anything in the model that can be bound directly by the view has no need of involving the "something else" at all.

My personal favorite is MVVM. I love the fact that a "view model" is conceptually just a "model" with all the aspects of any other model except that it doesn't (normally) ever get written out to disk. In fact, if it weren't confusing "MVVM" could be renamed to "MV", since it pretty much dispenses with the need for anything else but views and models. MVVM can be used not only with WPF but with any presentation framework that has advanced data binding capabilities. Unfortunately this excludes GWT and Cocoa. I also like MVVM because it tends to entirely eliminate redundant or repetitive code.

MVVM is not the only advanced player in town. Aspect-oriented approaches and command archtectures built on traditional models and views also have similar aspirations.

The bottom line is, this is still an actively researched area and there has been no consensus reached at this time. MVVM is the most popular of the new architectures but not the only one. The jury is still out.

Note: To get some idea of how the newer architectures are improvements over MVC and MVP, check out this comparison of Cocoa and WPF starting at the heading "Repetitive code" and going down to the end of the "Command Architecture" section.

や莫失莫忘 2024-09-13 23:38:09

最近,谷歌正在为胖客户端进行最新的架构研究。与 MVP 架构。

查看有关 MVP 的 GWT 文章
http://code.google.com/webtoolkit/articles/mvp-architecture。 html
http://code.google.com/webtoolkit/articles/mvp- Architecture-2.html

另请查看http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/8b0ae5eaf84d8bc2?hide_quotes=no

另请观看此 YouTube 视频 http://www.youtube.com/watch?v=PDuhR18-EdM

至于回答您的问题,除了说 MVC 有点过时了,我认为走哪条路是非常主观的。它不是特定于平台的,除了您选择的框架可能决定架构:(

The newest architectural research being done these days for Thick Clients is being done by Google. with the MVP architecture.

Check out the GWT articles on MVP
http://code.google.com/webtoolkit/articles/mvp-architecture.html
http://code.google.com/webtoolkit/articles/mvp-architecture-2.html

Also look at this http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/8b0ae5eaf84d8bc2?hide_quotes=no

Also check out this YouTube Video http://www.youtube.com/watch?v=PDuhR18-EdM

As far as answering your question, except for saying that MVC is kind of dated, I think it is very subjective on which way to go. It is not platform specific, except that the Framework you pick might dictate the Architecture :(

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文