是否始终需要MVVM体系结构? [英] Is an MVVM architecture always needed?

查看:59
本文介绍了是否始终需要MVVM体系结构?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我了解MVVM的概念是通过Java来实现的,并且使用了类似的MVC概念.现在,它一直是使用MVC鼓入我的,如果不是在MVC中,那么它就不是很好的编码.

我的问题是这是否适用于MVVM?要成为C#中的好代码,是否需要遵守MVVM体系结构?

为答复加油

Hi, I understand the concepts of MVVM by background is in Java and uses the similar concept of MVC. Now it has always been drummed into me use MVC, if it is not in MVC then it isn''t good coding.

My question is does this apply to MVVM? To be good code in C# does it need to adhere to the MVVM architecture?

Cheers for the replies

推荐答案

不,并非总是如此.

它非常依赖于应用程序,尤其取决于其复杂性,对UI的功能要求,控制反转的需求( http://en.wikipedia.org/wiki/Inversion_of_control [^ ])和其他因素.

在许多情况下,您可能希望自己动手做.这种情况可以是非常简单的情况,也可以是极少数情况下的极其复杂的情况,在这些情况下,您可以使用众所周知的架构模式的思想或某种组合,然后添加其他内容.但是,在大多数情况下,我会认为是一种众所周知的建筑模式( http://en .wikipedia.org/wiki/Architectural_pattern [ ^ ] )将是最好的.

无论如何,最好了解以下架构模式:
MVVM —模型视图视图模型,
http://en.wikipedia.org/wiki/Model_View_ViewModel [> http://en.wikipedia.org/wiki/Model-view-controller [ ^ ])),

MVA —模型视图适配器,
http://en.wikipedia.org/wiki/Model–view–adapter [ ^ ],

MVP —模型视图呈现器,
> http://en.wikipedia.org/wiki/Model-view-presenter [ ^ ].
-SA
No, not always.

It depends on the application very much, in particular, on its complexity, functional requirements to UI, need in inversion of control (http://en.wikipedia.org/wiki/Inversion_of_control[^]) and other factors.

In many cases you would prefer you own home-baked approach. Such cases can be either very simple cases, or on rare occasion, extremely complex ones, where you might use the ideas of the well-known architectural patterns or some combination and add something else. However, I would think in majority of cases one of the well-know architectural patterns (http://en.wikipedia.org/wiki/Architectural_pattern[^]) will be the best.

Anyway, it''s good to have good understanding of the following architectural patterns:
MVVM — Model View View Model,
http://en.wikipedia.org/wiki/Model_View_ViewModel[^],

MVC — Model-View-Controller,
http://en.wikipedia.org/wiki/Model-view-controller[^]),

MVA — Model-View-Adapter,
http://en.wikipedia.org/wiki/Model–view–adapter[^],

MVP — Model-View-Presenter,
http://en.wikipedia.org/wiki/Model-view-presenter[^].
—SA


这篇关于是否始终需要MVVM体系结构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆