3层和MVVM架构之间的区别? [英] Difference Between 3-Tiers and MVVM architecture?

查看:86
本文介绍了3层和MVVM架构之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨专家

你能解释一下3层和MVVM架构有什么区别吗?

哪一个在何时何地使用以及为什么。



谢谢你

dinesh sharma

Hi Experts
Can you explain me what is difference between 3-tiers and MVVM architecture?
which one when and where use and why.

thank u
dinesh sharma

推荐答案

这个错误认为一切都可以比较来自于?没有意义,真的。



只需了解两者:



http://en.wikipedia.org/wiki/3-tier_architecture [ ^ ],

http://en.wikipedia.org/wiki/MVVM [ ^ ]。



-SA
Where this false believe that everything can compare comes from? Makes no sense, really.

Just learn about both:

http://en.wikipedia.org/wiki/3-tier_architecture[^],
http://en.wikipedia.org/wiki/MVVM[^].

—SA


MVC与3层架构 [ ^ ]


3-tier Architecture

----------------------------

在3层架构中,用户界面层,业务逻辑层和数据库层就在那里。

In UI层,UI与Presentation代码和应用程​​序逻辑混合,这违反了SRP(单一责任原则)规则。



SRP:在面向对象的编程中,单一责任原则规定每个对象应该只有一个责任,并且该责任应该由类完全封装。它的所有服务都应该与这个责任完全一致。





MVVM架构:

---- ----------------

模型 - 视图 - ViewModel模式



在MVVM中的UI层分为两层。 ViewModel负责应用程序逻辑,而View只负责演示。

这可以让你做三件非常重要的事情:

1。更好的代码可维护性。



2.更容易与VS设计师合作。(这可以说是MVVM最强大的功能。它确实提高了生产力)



3.允许使用自动化测试来测试ViewModel,而到目前为止我们必须测试UI本身,并且在UI上进行自动化测试很复杂。这称为可测试性



由于这些原因,WPPF遵循这种模式。
3-Tier Architecture
----------------------------
In 3- tier architecture, the UI layer, the Business Logic layer and the DataBase layer is there.
In UI layer, the UI is mixed up with Presentation code and Application logic, this violates SRP(Single Responsibility Principle) rules.

SRP: In object-oriented programming, the single responsibility principle states that every object should have a single responsibility, and that responsibility should be entirely encapsulated by the class. All its services should be narrowly aligned with that responsibility.


MVVM architecture:
--------------------
Model- View- ViewModel pattern

In MVVM the UI Layer is separated into two layers. the ViewModel, which is in charge of the Application Logic, and the View, which is in charge solely on presentations.
This allows you three very important things:
1.Better Code Maintainability.

2.Easier to work with VS designer.(this is arguably the strongest feature of MVVM. It really boosts up productivity)

3.Allows for testing of the ViewModel with automated tests, whereas up until now we had to test the UI itself, and doing automated tests on UI is complex. This is called Testability

WPPF follows this patterns because of these reasons.


这篇关于3层和MVVM架构之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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