Presenter First Design Pattern

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gav

    Presenter First Design Pattern

    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


  • =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=

    #2
    RE: Presenter First Design Pattern

    Not to be a downer on the MVP, bit that sure seems like having to go through
    a lot just to call ShowDialog.
    -- Peter

    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
    >
    >
    >

    Comment

    • Gav

      #3
      Re: Presenter First Design Pattern


      "Peter Bromberg [C# MVP]" <pbromberg@yaho o.NoSpamMaam.co mwrote in message
      news:8888DC24-D4C0-4807-B759-8F62CB314318@mi crosoft.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.


      Comment

      • Kevin Spencer

        #4
        Re: Presenter First Design Pattern

        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 "dependenci es" 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" <gav@nospam.com wrote in message
        news:eSJfDvKIIH A.4956@TK2MSFTN GP06.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
        >

        Comment

        Working...