下面是AngularJS页面的内容描述:

AngularJS就是HTML,如果它是为构建web应用而设计的。带有数据绑定的声明式模板,MVW, MVVM, MVC,依赖注入和出色的可测试性故事,所有这些都是用纯客户端JavaScript实现的!

MVW代表什么呢? (考虑到MVC, MVVW, MVP等争论,我猜“whatever”,模型-视图- whatever =P)


当前回答

它确实代表任何东西,就像Igor Minar从2012年(强调我的)所说的任何对你有用的东西:

MVC vs MVVM vs MVP. What a controversial topic that many developers can spend hours and hours debating and arguing about. For several years +AngularJS was closer to MVC (or rather one of its client-side variants), but over time and thanks to many refactorings and api improvements, it's now closer to MVVM – the $scope object could be considered the ViewModel that is being decorated by a function that we call a Controller. Being able to categorize a framework and put it into one of the MV* buckets has some advantages. It can help developers get more comfortable with its apis by making it easier to create a mental model that represents the application that is being built with the framework. It can also help to establish terminology that is used by developers. Having said, I'd rather see developers build kick-ass apps that are well-designed and follow separation of concerns, than see them waste time arguing about MV* nonsense. And for this reason, I hereby declare AngularJS to be MVW framework - Model-View-Whatever. Where Whatever stands for "whatever works for you". Angular gives you a lot of flexibility to nicely separate presentation logic from business logic and presentation state. Please use it fuel your productivity and application maintainability rather than heated discussions about things that at the end of the day don't matter that much.

其他回答

它确实代表任何东西,就像Igor Minar从2012年(强调我的)所说的任何对你有用的东西:

MVC vs MVVM vs MVP. What a controversial topic that many developers can spend hours and hours debating and arguing about. For several years +AngularJS was closer to MVC (or rather one of its client-side variants), but over time and thanks to many refactorings and api improvements, it's now closer to MVVM – the $scope object could be considered the ViewModel that is being decorated by a function that we call a Controller. Being able to categorize a framework and put it into one of the MV* buckets has some advantages. It can help developers get more comfortable with its apis by making it easier to create a mental model that represents the application that is being built with the framework. It can also help to establish terminology that is used by developers. Having said, I'd rather see developers build kick-ass apps that are well-designed and follow separation of concerns, than see them waste time arguing about MV* nonsense. And for this reason, I hereby declare AngularJS to be MVW framework - Model-View-Whatever. Where Whatever stands for "whatever works for you". Angular gives you a lot of flexibility to nicely separate presentation logic from business logic and presentation state. Please use it fuel your productivity and application maintainability rather than heated discussions about things that at the end of the day don't matter that much.

话虽如此,我还是希望开发者能够开发出出色的应用 精心设计并遵循关注点分离,而不是看到它们被浪费 时间争论MV*废话。因此,我在此宣布 AngularJS将成为MVW框架-模型-视图-随便什么。在任何 代表“任何适合你的”。

图片来源:AngularJS Post - Igor Minar

MVW代表模型-视图-随便什么。

为了完整起见,以下是所有提到的首字母缩略词:

MVC -模型-视图-控制器 MVP -模型-视图-演示器 MVVM -模型-视图-视图模型 MVW / MV* / MVx -模型-视图-任意

还有更多:

HMVC -分层模型-视图-控制器 MMV -多用途模型视图 MVA -模型-视图-适配器 MVI -模型-视图-意图

https://en.wikipedia.org/wiki/MVW https://en.wikipedia.org/wiki/AngularJS https://angularjs.org/

AngularJS -超级英雄的JavaScript MVW框架

https://plus.google.com/+AngularJS/posts/aZNVhj355G2

我觉得MWV (Model View Whatever)或MV*是一个更灵活的术语,可以用来描述Angularjs的一些独特性。它帮助我理解它不仅仅是一个MVC(模型视图控制器)JavaScript框架,但它仍然使用MVC,因为它有一个模型视图和控制器。

它也可以被认为是一个MVP (Model - View - Presenter)模式。我认为Presenter是Angularjs中View的用户界面业务逻辑。例如,通过使用可以格式化数据以供显示的过滤器。这不是业务逻辑,而是显示逻辑,它让我想起了我在GWT中使用的MVP模式。

此外,它也可以是一个MVVM(模型视图视图模型),视图模型部分是两者之间的双向绑定。最后,它是MVW,因为它有其他的模式,你可以使用以及@Steve Chambers提到的。

我同意其他的回答,对这些术语过于迂腐可能是有害的,因为关键是要从术语中理解概念,但同样地,充分理解这些术语在设计应用程序代码时也会有所帮助,知道什么放在哪里以及为什么要这样做。