views:

1194

answers:

4

I have seen some developers attempting to shoehorn the MVC or MVP patterns into Winforms applications, presumably on the premise that, if it's good for WPF and ASP.NET, then it must be good for Winforms.

Is this a good idea, or is it lipstick on a pig? Why or why not?

+6  A: 

Most certainly not. I prefer MVP but either are much better than embedding logic in winforms.

Both for testability and best practice.

Finglas
I have historically done this by moving program logic to another module/dll. Is this essentially the same thing as MVC?
Robert Harvey
Sounds close. The idea behind a good GUI is to be as thin as possible. With MVP say the logic is removed, and simply presented. E.g. simple gets and sets.
Finglas
Accepted answer for the comment.
Robert Harvey
A: 

Once, I would have say : it is NOT a good idea, because the mix gives a unmaintainable code ...
But, have a look at this framework...

Matthieu
_@Matthieu:_ Even though I didn't downvote your answer, it would have been interesting to read about why you think MVC/MVP as applied to Winforms results in unmaintainable code.
stakx
+1  A: 

One of our most recent development efforts produced a MVP windows forms application. The benefit we saw from using this pattern was that all of the subsequent changes that we made have been quick and easy because we either already had the hooks into the functionality that we needed or we could very quickly create them by following the patterns already implemented in the application.

Christian Pena
+1  A: 

You may find the answers to Implementing MVC with Windows Forms helpful as they talk about the different options when implementing MVC and MVP

Ian Ringrose