1

I hope someone can answer these.

I have a WinForms project with +/- 8 forms. I have an SQLite database and a class that handles the queries to this database. I would like to use the passive View pattern so that the View has no link to the Model.

  1. Is a form a View?/ Can a form be a View? Which derives from a IFormView class
  2. Does each form have their own Presenter? If not, how is this organized instead?
  3. Does the Presenter from one form, create another form/View when i want a control on the one form to open another form?
  4. Is my database class a Model? All of my required data is inside the database, so this class had access to it, but does not really store it as i've seen in many examples. Or do i need to create Models that have the required data as an attribute (which is updated by and obtained from the database).

Thank you for answering.

3
  1. Is a form a View?/ Can a form be a View? Which derives from a IFormView class

Yes. Precisely.

  1. Does each form have their own Presenter? If not, how is this organized instead?

That is typically how I approach it.

  1. Does the Presenter from one form, create another form/View when i want a control on the one form to open another form?

Yep. You nailed it.

  1. Is my database class a Model? All of my required data is inside the database, so this class had access to it, but does not really store it as i've seen in many examples. Or do i need to create Models that have the required data as an attribute (which is updated by and obtained from the database).

That depends on what you mean by "Model". It's an ambiguous word.

You may have any or all of the following:

  • View Models which represent visual elements. (Think MVC view model, not the VM from MVVM, which is actually a controller).
  • Business models which consists of one or more classes that contains the "business logic" that the Presenter delegates it's work to.
  • Data models that represent how the data is actually persisted.

Typically, the "Model" in MVC (the architecture, not the framework) refers to the business model.

...naming is hard.

  • Thank you so much. So if I may ask one more question, Does each form/View have their own interface/base class which they derive from and their Presenter connects to? Since each form has different events this seems logical to me, but i thought i'd better ask :) – Marthe Veldhuis Oct 10 '16 at 6:18
  • They may all derive from some base view class, but they're all going to different (otherwise why would you need different forms), so you'll have at least one view interface for each form. – RubberDuck Oct 10 '16 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.