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

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.

主站蜘蛛池模板: 鄂托克旗| 新兴县| 马鞍山市| 普兰县| 衡水市| 平利县| 宝清县| 满城县| 全南县| 长垣县| 青龙| 绥滨县| 莒南县| 麻阳| 武乡县| 西充县| 伊通| 贡嘎县| 台中市| 青冈县| 舟山市| 大城县| 凤台县| 岐山县| 漳平市| 会昌县| 长子县| 六枝特区| 句容市| 舟曲县| 花垣县| 安西县| 江阴市| 泌阳县| 彭泽县| 仙游县| 清水县| 钟祥市| 新龙县| 台州市| 汽车|