1

I have never used MVC before and would like some advice.

I have actually already written quite a bit of code, but looking at it, it seems to be quite highly coupled between classes and there is a lot of code written on the actual main form of the winform. I am a University student, recently started on a 12 month placement, so do not have much real world experience.

My system is effectively a WinForm GUI that has, amongst other things, a treeview that is popualted at load via an event. And then when the user clicks on a node, it gets a datagridview from a dllplugin (which obtains the data from an Oracle DB via a perl script.

My question, is would MVC apply in this circumstance, and would anybody have any good advice/resources on how I can now, post-design to implement it?

Thanks.

3 Answers 3

2

The MVP pattern is more adapted to WinForms applications. Here's a nice article you may take a look at.

Sign up to request clarification or add additional context in comments.

Comments

1

Received wisdom is that MVC is good for the web but has some constraints when operating in a desktop environment (I'm not sufficiently experienced in applying this sort of pattern in either context to make a worthwhile judgement).

The pattern that Microsoft (for one) are pushing for forms use is MVVM - which is Model View View Model - and it provides a similar set of benefits in terms of separation and testability. Even allowing that I could wish I knew more I can see what and why, especially if you're looking at WPF (and Silverlight) but in any context where you're trying to ensure separation.

5 Comments

Thanks. Will take a look at MVVM.
In WinForms MVVM is typically referred to as MVP (Model View Presenter).
@Fara - I believe that MVVM and MVP are similar but not identical
They're the same basic pattern, just different implementations.
Well that kind of makes them not the same pattern. Though we're tending towards "religious argument" territory.
0

The MVC pattern can work well with WinForms, see this question.

There are lot of related pattern to choose from; in the case of WinForms (unlike WPF) there is no clear winner.

Partly this is due to everyone having different aims, do you care most about:

  • Code reuse between Forms in the UI
  • Being able to support form the one UI system
  • Easy unit testing
  • Etc

1 Comment

I'm not sure if I am using some variation already. One aspect of my application is extracting information from Excel. Dependant on the data, different methods are applied. These methods are written in dll's which interact with the GUI through an interface I designed. So the user clicks a button on the GUI, which interacts with the DLL, which in return, returns back sone status information. Is this an example of MVC? Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.