官术网_书友最值得收藏!

So how does MVVM help?

One major benefit of adopting MVVM is that it provides the crucial Separation of Concerns between the business model, the UI, and the business logic. This enables us to do several things. It frees the View Models from the Models, both the business model and the data persistence technology.

This in turn enables us to reuse the business model in other applications and swap out the DAL and replace it with a mock data layer so that we can effectively test the functionality in our view models without requiring any kind of real data connection.

It also disconnects the Views from the View logic that they require, as this is provided by the View Models. This allows us to run each component independently, which has the advantage of enabling one team to work on designing the Views, while another team works on the View Models. Having parallel work streams enables companies to benefit from vastly reduced production times.

Furthermore, this separation also makes it easier for us to swap the Views for a different technology without needing to change our Model code. We may well need to change some aspects of the View Models, for example, the new technology used for the Views may not support the ICommand interface, but in principle, the amount of code that we would need to change would be fairly minimal.

The simplicity of the MVVM pattern also makes WPF easier to comprehend. Knowing that each View has a View Model that provides it with all the data and functionality that it requires means that we always know where to look when we want to find where our data bound properties have been declared.

主站蜘蛛池模板: 龙井市| 龙南县| 富宁县| 姜堰市| 兴城市| 博湖县| 新安县| 乌苏市| 明光市| 武定县| 大庆市| 巴青县| 突泉县| 九寨沟县| 河间市| 原阳县| 灵石县| 肇州县| 吉水县| 汝南县| 巍山| 榆中县| 沁源县| 丰镇市| 瓦房店市| 淅川县| 会同县| 安西县| 威宁| 惠来县| 沙洋县| 封丘县| 增城市| 武穴市| 法库县| 五原县| 天祝| 贵州省| 桓台县| 沐川县| 项城市|