Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using MVC MVP patterns in winforms [closed]

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.

like image 334
P.K Avatar asked Aug 02 '09 21:08

P.K


2 Answers

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.

like image 177
JP Alioto Avatar answered Sep 22 '22 18:09

JP Alioto


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.

like image 24
Reed Copsey Avatar answered Sep 21 '22 18:09

Reed Copsey