mvp

Best Practices for asynchronous calls in MVP with WinForms

I am using the Model-View-Presenter pattern in a WinForms project and one problem (among many) that I am having is when the form tells the presenter to do something and then is un-reactive while the presenter goes of to do it. Fortunately in my project I have no problem with making all presenter calls asynchronous the question is how ex...

What's a good practice for dividing up presenters in a MVP interface pattern that have grown to large?

One problem that I have frequently run into lately is the problem of my presenter classes growing too large. Usually, I can chop up a regular large class without skipping a beat. But the presenters sometimes are a little more difficult to pare down, without making the code harder to follow. Especially when the page starts filling up...

Composite Guidance for WPF : MVVM vs MVP.

Hi, I am confused. Maybe you can help me :) I have been following the guidance of CAG and found the MVP pattern very natural to me. Suppose I have a UI-ready Model (for example : implements INotifyPropertyChanged), I use the presenter to bind this Model to a view (presenter knows an interface of the view), keeping my Code-Behind as sma...

Where do I put dependency creation for a Presenter class in a Passive View architecture?

I've just refactored out a new domain class from a presenter class but I can't figure out where to instantiate it. This is part of a larger ongoing refactoring effort with a poorly maintained legacy project. The Presenter is currently being created by the view's OnLoad event and the view is passed as a parameter in the constructor. All...

Why did Microsoft choose MVC for ASP.NET?

In addition to being a 30 year pattern, MVC was never meant for current applications. MVP was its successor and designed to handle event based apps coming out in the 90s. Passive View and Supervising Controller seem to have risen to the top. For those two, it almost isn't necessary to talk about MVC/MVP. Specifically, is the controll...

MVP pattern, how many views to a presenter?

We are trying to get the Model-View-Presenter pattern used on (virtually) all new dev work that we undertake. I'm a strong believer in having a framework to help people meet a design requirement, we have a few in-house frameworks for various different components (logging, email sending, etc), so I'm trying to get some kind of MVP framew...

MVP vs MVC

Duplicate: What are MVP and MVC and what is the difference? In a nutshell, what's the diff? When would I choose one over the other? ...

Winforms MVP Grid Events Problem

I am trying to implement the MVP pattern for WINFORMS. Its a simple for with a button and a Grid, on button click, the grid will load, and user can fill in values into the grid. For my button click event, I have something like this: _presenter.LoadGrid(); Which is simple and straightforward. My question is, in regards to grid... I am...

Model-View-Presenter: Validate UI

Hello Everyone I am looking for a best-practise approach on how to do UI-validation in a model-view-presenter architecture. I need to validate some forms with a lot of controls, and to make it easy for the user I store all errors or warnings with a reference to the control in a Log which is displayed to the user afterwards, so he can ...

What rules do you use to delineate MVP methods and members.

When using the MVP pattern, I often come across methods and members which don't seem to fall nicely within the View or Presenter classes...My question is: What rules do you use to decide what functionality lies which classes? I am relatively new to MVP, so please humour me. TIA. ...

Filter/Sort in the view or in the model?

Having a list of data object and something visual to represent each, where would you code the sorting/filtering logic? Why? Edit : All the answers so far are good, but I forgot to add another constraint. What if I don't want to reconstruct the view each time? ...

Is there any good open source ASP.NET application using MVP pattern

Hi All, I'm trying to upgrade my existing web forms application to upcoming framework and rewriting couple of workflow as per the new business requirements. I want to introduce TDD based development in this project but after some investigation found that ASP.NET MVC will not help me as my web existing application is using lots of Infra...

How does one become a Microsoft - Most Valuable Professional (MVP)?

What are the eligibility criteria? Are there any specific benefits? Existing MVPs please chime in. I am wondering why I am still not an MVP despite being an active participant in the Microsoft community. ...

MVP - Dependency Injection and the model.

Given a View uses a Presenter, and in the presenter you have a model. How do you inject the model into the presenter? If I was to inject it at the View level, you're back to square one with business logic being in the view - aka the view should not know about its model. Any advice? ...

Good example/reference of using TDD with Model View Presenter using Rhino Mocks.

Appreciate any good example or references to websites which has useful information of using TDD with Model-View-Presenter pattern using Rhino Mocks. What I am looking for is with respect to the following points What to mock (view and presenter) The new AAA syntax How to mock UI behaviour? e.g. if "firstName" and "lastName" entered in...

How to handle FormClosing using MVP.

Here goes: I have a view that looks like this: public interface IAddressView { void Close(); bool IsDirty(); bool DoesUserWantToDiscardChanges(); } I have a presenter that looks like this: public class AddressViewPresenter { private IAddressView m_addressView; private Address m_address; public AddressView...

Model View Presenter - Handling more complex UI controls

Hi all, I'm investigating the Model View Presenter pattern. So far I like what I see, however pretty much all of the articles, webcasts, podcasts etc. I've seen, read or heard tend to deal with setting and retrieving simple types from textboxes and I'm struggling to understand how to deal with more complicated UI controls. For example,...

Getting user input from Model Layer

Have a problem following the MVP or MVC design pattern (applies to either one). I can't figure out how to cleanly prompt for user input from the model layer? Depending upon certain values in the model, I may need to prompt the user for input during the middle of a process. For example, we'll take a hypothetical PO entry process. Say ...

MVP - Public Methods or subscribe to View events

Hello I have written a MVP project where the View is a WinForm that implements my IView interface. I am in the process of reviewing the code, improing it where I can and would like to ask your thoughts regarding how the view and presenter interact. Which of the following is bext practisce in your opinion? 1) Expose methods of the prese...

How should I expose hierarchical data from a TreeView control to a MVP presenter?

I have some hierarchical data in a Winforms TreeView control and I need to expose it as a property so my presenter can synchronize changes to it. Just to be clear, I'm using the Passive View pattern. With most WinForm controls this is a no-brainer. The controls themselves expose their data as a system type which can easily be passed alon...