Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7166737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:27:42+00:00 2026-05-28T14:27:42+00:00

I’ve started to wrap my head around the whole MVP pattern and despite I’m

  • 0

I’ve started to wrap my head around the whole MVP pattern and despite I’m doing fine with single objects it starts getting difficult when it comes to collections.

So let’s say we’re architecting a simple WinForms application that consists of a DataGrid within a Form, with the data Model being a simple collection of stuff, where such stuff has a bunch of properties and the View is going to actually display them:

Model

public class Person
{
    public string Name { get; set; }
    public DateTime Birth { get; set; }
    public bool IsCool { get; set; }
}

public class People
{
    public List<Person> Persons { get; set; }
}

View

public interface IPeopleView
{
    List<People> ListOfPeople { get; set; }
}

public partial class PeopleViewImpl : Form, IPeopleView
{
    private DataGridView _grid = new DataGridView();

    public PeopleViewImpl()
    {
        InitializeComponent();
    }

    // Implementation of IPeopleView
    public List<People> ListOfPeople
    {
        get { return /* TODO */; }
        set { _grid.DataSource = value; }
    }
}

Presenter

public class PeoplePresenter
{
    private People _model;
    private IPeopleView _view;

    public PeoplePresenter(People model, IPeopleView view)
    {
        _model = model;
        _view = view;
    }

    void UpdateView()
    {
        _view.ListOfPeople = _model.Peoples;
    }
}

So what should I implement at View’s List<People> ListOfPeople getter as well as how should I invoke Presenter’s UpdateView()?

And generally, which extra Presenter methods would be interesting to have in order to achieve MVP Passive View and Supervising Controller respectively?

Any advice, code style review or opinion will be sincerely appreciated. Thanks much in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T14:27:43+00:00Added an answer on May 28, 2026 at 2:27 pm

    First of all, you should decide for one pattern:

    • Supervising Controller is appropriate if you want to leverage data binding and if a tool for automated view tests is available
    • Passive View is indicated if your view data becomes more complex or if you have to rely on pure unit tests for the complete view
    • Presentation Model (also known as Model View ViewModel) is ideal if you need easy access to the complete view state and if you have code generation available

    I have collected all aspects as well as links to useful considerations and examples.

    In either case, you should define a PeopleModel and let PeopleViewImplementation reference PeopleModel. This clearly separates the model from the view.

    When it comes to collections, Supervising Controller can rely on the data binding of a list to the DataGridView. See winForms + DataGridView binding to a List. Only Passive View and Presentation Model require additional code for mapping the list to the view fields respectively to the Presentation Model.

    Secondly, the data mapping should be clarified: Should PeopleView show a list of persons or a list of several peoples? The DataGridView can either display one person per row or one people per row. If one person is displayed per row, the treatment of the people could be achieved in one of the following ways, for example:

    • Show all persons of one people on one page and add a pager element to navigate between different peoples
    • Show all persons of one people in the data grid and add a selection widget for the people, e.g. a tree with all peoples
    • Mix persons of different peoples in the data grid and add a column to display the people of each person
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am doing a simple coin flipping experiment for class that involves flipping a
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.