473,396 Members | 2,002 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Presenter First Design Pattern

Gav
I have just started to rewrite my application using the Presenter First
Design Pattern to make sure my business logic is not in the Gui itself. I've
got the general idea but I'm a bit unsure as to how I should be launching a
dialogue window from my main application window.

What i have done is this in a nutshell. My main application window comprises
of a Model, Presenter and a View. The Popup window also has a Model,
Presenter and View. This is the process of what happens when the button is
clicked is as follows.

1. Button clicked, delegate function in presenter called from main View.
2. Method in main presenter calls a method in main model to open the window.
3. Method in main model instanciates popup view, popup model and binds with
popup presenter.
4. Method in main model calls method in popup model to open the window.
5. Method in popup model uses delegate function to call method in popup
presenter.
6. Method in popup presenter calls function in popup view to display the
window.

Can anybody tell me if what I am doing sounds right?

thanks

Gav
Nov 6 '07 #1
3 3626
Not to be a downer on the MVP, bit that sure seems like having to go through
a lot just to call ShowDialog.
-- Peter
http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

"Gav" wrote:
I have just started to rewrite my application using the Presenter First
Design Pattern to make sure my business logic is not in the Gui itself. I've
got the general idea but I'm a bit unsure as to how I should be launching a
dialogue window from my main application window.

What i have done is this in a nutshell. My main application window comprises
of a Model, Presenter and a View. The Popup window also has a Model,
Presenter and View. This is the process of what happens when the button is
clicked is as follows.

1. Button clicked, delegate function in presenter called from main View.
2. Method in main presenter calls a method in main model to open the window.
3. Method in main model instanciates popup view, popup model and binds with
popup presenter.
4. Method in main model calls method in popup model to open the window.
5. Method in popup model uses delegate function to call method in popup
presenter.
6. Method in popup presenter calls function in popup view to display the
window.

Can anybody tell me if what I am doing sounds right?

thanks

Gav
Nov 6 '07 #2
Gav

"Peter Bromberg [C# MVP]" <pb*******@yahoo.NoSpamMaam.comwrote in message
news:88**********************************@microsof t.com...
Not to be a downer on the MVP, bit that sure seems like having to go
through
a lot just to call ShowDialog.
-- Peter
It certainly is, although it did not take too long to put together. Thats
one of the reasons I'm not sure if I'm going about it in the right way.
Nov 6 '07 #3
First, there should only be one Model, and one Presenter. The Model is the
Service (assembly) that contains all the data and business logic. The
Presenter is the class that acts as the intermediary between the UI (which
may be comprised of many UI elements, including Forms) and the Model (which
may be comprised of many logical components). The Presenter contains the UI
logic, and the Model contains the business logic. The Model therefore should
never call any methods in (have any dependencies upon) the Presenter. The
Presenter talks to interfaces that are implemented by the Model and the
View. It is these interfaces that form the "dependencies" of the Presenter.
The Presenter is the Controller of both the View and the Model, and it
manages communication between them via these interfaces that must be
implemented by the View and the Model. This way, any UI that implements the
correct interface may be used.

--
HTH,

Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP

"Gav" <ga*@nospam.comwrote in message
news:eS**************@TK2MSFTNGP06.phx.gbl...
>I have just started to rewrite my application using the Presenter First
Design Pattern to make sure my business logic is not in the Gui itself.
I've got the general idea but I'm a bit unsure as to how I should be
launching a dialogue window from my main application window.

What i have done is this in a nutshell. My main application window
comprises of a Model, Presenter and a View. The Popup window also has a
Model, Presenter and View. This is the process of what happens when the
button is clicked is as follows.

1. Button clicked, delegate function in presenter called from main View.
2. Method in main presenter calls a method in main model to open the
window.
3. Method in main model instanciates popup view, popup model and binds
with popup presenter.
4. Method in main model calls method in popup model to open the window.
5. Method in popup model uses delegate function to call method in popup
presenter.
6. Method in popup presenter calls function in popup view to display the
window.

Can anybody tell me if what I am doing sounds right?

thanks

Gav

Nov 7 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Omer van Kloeten | last post by:
The Top Level Design: The class Base is a factory class with a twist. It uses the Assembly/Type classes to extract all types that inherit from it and add them to the list of types that inherit...
11
by: FluffyCat | last post by:
In Febraury - April of 2002 I put together in Java examples of all 23 of the classic "Gang Of Four" design patterns for my website. Partly I wanted to get a better understanding of those patterns....
22
by: Krivenok Dmitry | last post by:
Hello All! I am trying to implement my own Design Patterns Library. I have read the following documentation about Observer Pattern: 1) Design Patterns by GoF Classic description of Observer....
1
by: Max André Bündchen | last post by:
I'm starting a new project based on webservices as mediator for the clients and the servers. I must develop two presentation layers, one in winforms performing a smart client application and...
10
by: Sean Chambers | last post by:
Hello, I am attempting to utilize the MVP pattern in a new app I am building. I am using TDD, along with mock views attached to the View interface to attempt to unit test the UI. The problem I...
1
by: peter shaw | last post by:
Hi, I have a solution, that includs a project. The project have some folder, (like folder1, folder2, folder3,...). Inside folder there is a view and view presenter. Directly under project,...
12
by: Doug | last post by:
Hi, I learned a little about the model view presenter pattern at a conference this last week and am experimenting with it. It's working pretty well but I have a question. I am trying to use...
6
by: Bill44077 | last post by:
Hi, I am new to the MVP pattern and one of the main reasons that we are going this route is because we are doing Scrum with 30 day sprints - so we have a continually morphing design. We are...
1
by: Dan | last post by:
Hi Am interested in learning more about Model View Presenter (MVP) design. Specifically to create an application using vs2005 with winforms that use webservices to process business logic. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.