views:

580

answers:

5

I have read online about MVC, MVP patterns for UI design. But, I can't quite grasp how the it works even after re-reading it couple of times. I use C#/winforms for development. Can someone point me to a good book/blog/website? Something that will make me decide if I should adopt it or not. Thanks.

+3  A: 

I actually think Wikipedia's page on MVC has a very good overview of the Model View Controller architecture.

You can do MVC with Windows Forms and C#, but it is more difficult than with other platforms. MVC is all about separation of concerns - and should be usable with any platform. However, certain platforms make this much easier than others.

The "trick" to getting this to work well in a Windows Forms application is making sure to have a clear separation of concerns in how you design your forms. Try to keep some separation between the event handling (controller), the form design and layout (view), and the business logic and design (model). The basic design of windows forms doesn't explicitly force or guide you to having this separation, so it will just be up to you to keep those things separate.

The trickiest one in Windows forms is keeping the view and controller from getting too interdependent. The WinForm designer naturally puts all of the event handling into the same class as the form, so it's easy to get the two things tied together. You'll have to keep that separation in place yourself, if you want to follow the class MVC architectural patterns.

Reed Copsey
+7  A: 

Check out some of these videos over at PolymorphicPodcast. He does a good job of describing the MV* patterns and gives solid examples of each. Specifically, check out the winforms video.

JP Alioto
+1 for the podcast. I think upon watching them was when design first really clicked for me.
gWiz
A: 

How about this SO post. This has a good overview of that they are.

SwDevMan81
A: 

Start by reading Martin Fowler's comparative article on different GUI Architectures. It covers MVC (as MVP used to be called) and a lot of other useful information that should help to frame the concepts for you.

Hamish Smith
A: 

I just wrote a blog entry about using the MVP Passive View pattern.

http://coding.infoconex.com/post/(MVP)-Model-View-Presenter-Passive-View.aspx

Looking for feedback if I got anything wrong.

Jim Scott