Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #12326

Re: Hairy generics question

From sclaflin@webucator.com
Newsgroups comp.lang.java.programmer
Subject Re: Hairy generics question
Date 2012-02-25 10:27 -0800
Organization http://groups.google.com
Message-ID <18147154.963.1330194478893.JavaMail.geo-discussion-forums@vbai14> (permalink)
References <3c65271e-a388-49c9-bcc6-ca3bf274e74f@e27g2000vbu.googlegroups.com> <29108397.63.1330110725245.JavaMail.geo-discussion-forums@vbpw21> <ji8qfc$84a$1@news.albasani.net> <7822487.176.1330121248108.JavaMail.geo-discussion-forums@vbkl3> <aaV1r.13982$Pc2.8047@newsfe13.iad>

Show all headers | View raw


On Friday, February 24, 2012 6:36:37 PM UTC-5, Daniel Pitts wrote:

> In what way is a Presenter different from a "controller".  View's should 
> never know about Controllers, only about models.  Controllers know about 
> specific views and specific models.  Models know about generic 
> listeners, if you need to have an active view (non web-app stuff).

In my preferred concept of MVP, a view doesn't work directly with the model, which is why I suffixed my T type with Info. It's possible for the view to not know about the presenter, and a lot of MVP is done that way. But that requires the view to fire events that the presenter then registers to handle.

My problem with that approach is twofold:

1. It burdens a global event bus with lots of events that were only meant to be one source to one handler.  Especially in my app, where most of my views would fire events like editRequested or deleteRequested (most of these widgets are display-only, the edits are done via a popup).  So, the global event manager is going to have to hold a list of handlers for each event for all these views, and then iterate through the appropriate list each time to find the handler that matches the event source.  While intellectually pleasing from a maximum decoupling perspective, it's not very efficient.

2. It exposes what ought to private publicly, that being the event registration methods.  The view shouldn't be visible to anything but its presenter, but public void addEditRequestedHandler could be called from anywhere that has a reference to the view.  Granted, that reference shouldn't be held anywhere but in the presenter, but I could see someone that perceives MVP differently passing the reference outside the presenter.

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Hairy generics question sclaflin <steve@steveclaflin.com> - 2012-02-21 06:30 -0800
  Re: Hairy generics question Lew <noone@lewscanon.com> - 2012-02-21 09:24 -0800
  Re: Hairy generics question Roedy Green <see_website@mindprod.com.invalid> - 2012-02-21 11:05 -0800
    Re: Hairy generics question Lew <noone@lewscanon.com> - 2012-02-21 12:09 -0800
  Re: Hairy generics question Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-02-21 18:04 -0800
    Re: Hairy generics question Lew <noone@lewscanon.com> - 2012-02-21 18:31 -0800
    Re: Hairy generics question Steven Simpson <ss@domain.invalid> - 2012-02-22 08:31 +0000
  Re: Hairy generics question sclaflin@webucator.com - 2012-02-24 11:12 -0800
    Re: Hairy generics question Lew <noone@lewscanon.com> - 2012-02-24 12:03 -0800
      Re: Hairy generics question sclaflin@webucator.com - 2012-02-24 14:07 -0800
        Re: Hairy generics question Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-02-24 15:36 -0800
          Re: Hairy generics question sclaflin@webucator.com - 2012-02-25 10:27 -0800
          Re: Hairy generics question Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-02-26 13:13 -0400
            What is Model View Presenter. (Was: Hairy generics question) Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-02-26 10:22 -0800
              Re: What is Model View Presenter. (Was: Hairy generics question) Lew <noone@lewscanon.com> - 2012-02-26 13:08 -0800
                Re: What is Model View Presenter. (Was: Hairy generics question) Arne Vajhøj <arne@vajhoej.dk> - 2012-02-26 18:17 -0500
                Re: What is Model View Presenter. (Was: Hairy generics question) sclaflin@webucator.com - 2012-02-28 06:22 -0800
            Re: Hairy generics question Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-02-28 09:46 -0800
              Re: Hairy generics question Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-02-28 09:49 -0800
              Re: Hairy generics question Lew <noone@lewscanon.com> - 2012-02-28 12:45 -0800
              Re: Hairy generics question Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-02-29 19:37 -0400
                Re: Hairy generics question Lew <noone@lewscanon.com> - 2012-02-29 22:32 -0800

csiph-web