Meteor 中的 Resource-View-Presenter
Resource-View-Presenter in Meteor
在寻求 Meteor 最佳实践的过程中,我 运行 没有阿司匹林了。我喜欢开发具有一定意识的应用程序 - 例如,MVC 非常有助于 Rails 走上正轨。对于 Meteor,各种书籍陈述了不同类型的模式。有人说 'its MVC on various levels',其他人说 'MVVM' 或 'MVP'。每一次,我都被说服了。我偶然发现了 Resource View Presenter,这显然可以应用于 Meteor 中的反应式编程——作为主要参数
- 同构的用法javascript
- 模式 MVC、MVVM 和 MVP 不针对实时框架
因为我找不到关于 Resource-View-Presenter 的 Wikipage,我想知道它是否真的是一种不同的模式,被一个平台采用为 Meteor 或者只是一些同人小说,可以很容易地称为 MVVM还是MVP?我在这里找不到 RVP 标签的事实让我怀疑它的存在(及其参数)。
资源:
http://blog.nodejitsu.com/scaling-isomorphic-javascript-code/#rvp
我从流星论坛得到的回答:
In a sense Meteor is somewhere between MVC and MVVM. MVC is a cyclical
pattern specifically employed in early web and desktop UIs where
updates happen at the controller then populate to the model and then
to the view.
MVVM is an amorphic pattern in which updates happen somehow in the
model or view and are passed back and forth through the view model.
Meteor is basically one way MVVM. Updates in the model populate
through to the view by way of helpers and data contexts. This is
essentially the point of Blaze helpers - to build the view model
though it's not called that. Meteor doesn't have binding in the other
direction because in a highly decoupled asynchronous environment,
getting that right is very difficult and time consuming and they
haven't dedicated the time (and may never) to it. However, you can
always use events to simulate the binding the other way by updating
the model on appropriate updates. So utilizing the MVVM pattern is an
option, you just have to implement the bindings from the view to the
view model.
Of course add a router and some additional service layers and you can
go full on into the MVC direction as well and utilize the reactive
nature of Meteor to make MVC extremely responsive. The choice is
really up to you.
To be more precise, Meteor follows the MV* pattern with self updating
views that "react" to model changes. It's up to you to plug in
controllers or view models, or whatever middleware you want to use to
interact with the models. I will say that the MVC pattern works well
with web applications while the MVVM pattern (or the MVP pattern)
works well with native (or Cordova) applications.
https://forums.meteor.com/t/mvvm-as-typical-development-pattern/
在寻求 Meteor 最佳实践的过程中,我 运行 没有阿司匹林了。我喜欢开发具有一定意识的应用程序 - 例如,MVC 非常有助于 Rails 走上正轨。对于 Meteor,各种书籍陈述了不同类型的模式。有人说 'its MVC on various levels',其他人说 'MVVM' 或 'MVP'。每一次,我都被说服了。我偶然发现了 Resource View Presenter,这显然可以应用于 Meteor 中的反应式编程——作为主要参数
- 同构的用法javascript
- 模式 MVC、MVVM 和 MVP 不针对实时框架
因为我找不到关于 Resource-View-Presenter 的 Wikipage,我想知道它是否真的是一种不同的模式,被一个平台采用为 Meteor 或者只是一些同人小说,可以很容易地称为 MVVM还是MVP?我在这里找不到 RVP 标签的事实让我怀疑它的存在(及其参数)。
资源: http://blog.nodejitsu.com/scaling-isomorphic-javascript-code/#rvp
我从流星论坛得到的回答:
In a sense Meteor is somewhere between MVC and MVVM. MVC is a cyclical pattern specifically employed in early web and desktop UIs where updates happen at the controller then populate to the model and then to the view.
MVVM is an amorphic pattern in which updates happen somehow in the model or view and are passed back and forth through the view model.
Meteor is basically one way MVVM. Updates in the model populate through to the view by way of helpers and data contexts. This is essentially the point of Blaze helpers - to build the view model though it's not called that. Meteor doesn't have binding in the other direction because in a highly decoupled asynchronous environment, getting that right is very difficult and time consuming and they haven't dedicated the time (and may never) to it. However, you can always use events to simulate the binding the other way by updating the model on appropriate updates. So utilizing the MVVM pattern is an option, you just have to implement the bindings from the view to the view model.
Of course add a router and some additional service layers and you can go full on into the MVC direction as well and utilize the reactive nature of Meteor to make MVC extremely responsive. The choice is really up to you.
To be more precise, Meteor follows the MV* pattern with self updating views that "react" to model changes. It's up to you to plug in controllers or view models, or whatever middleware you want to use to interact with the models. I will say that the MVC pattern works well with web applications while the MVVM pattern (or the MVP pattern) works well with native (or Cordova) applications.
https://forums.meteor.com/t/mvvm-as-typical-development-pattern/