Which .NET 2.0 development pattern (MVP, MVC, etc.) is best suited to be reusable when migrating to WPF and MVVM?

We are looking at patterns such as MVP that can help us separate the user interface from logic from data. The initiative ends in the game, but this is an attempt to start setting the rules that we need in order to write more testable code (we are currently writing red tape, spaghetti, ducts and wood screws, etc.).

As we look at approaches to using WinForms 2.0, we also support WPF and the next generation of our product user interface. We are trying to create something that should be easily reused in the WPF world by pulling out the UI / View WinForms UI / View and hitting our new WPF / View user interface.

Does any particular development 2.0 template create a natural transition to the MVVM WPF template? What picture should we adhere to today, which will allow us to switch to WPF without requiring either hack WPF into our existing presentation logic, or significantly redo / move (again) our presentation logic to match WPF?

+4
source share
1 answer

The MVP pattern will give you this logical separation, but basically I believe that the power of MVP is to write test code.

I would recommend reading Uncle Bob's book, Robert C Martin, entitled Agile Principles, Patterns and practice.

I also think that you do not have to use a template like MVP to logically separate your business logic from your user interface level. If structured correctly, all of your business logic will then be in a business layer that is completely disconnected from your user interface level. You can then use several interfaces, such as WinForms, WebForms or WebService, or even WPF, to the same business layer without rewriting any business logic, verification, authorization, etc.

In this case, I would recommend reading a Rocky Lhotka book called Expert C # Business Objects. This book is easy to read, and it explains how to separate logical layers. Also its purpose is to keep the minimum user interface code.

+3
source

All Articles