Forum: Ruby on Rails Presenters out of vogue?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
91a72b0ad3e43e3ef3a31816667ec694?d=identicon&s=25 bill walton (Guest)
on 2009-03-29 19:58
(Received via mailing list)
My controllers have gotten unwieldy.  The situation looks well-suited to
the use of the MVP pattern but the latest links Google is giving me are
from '07. Looks like there was some pretty good discussion that just
fell off a cliff.  Has someone come up with a better solution?

A little background on my situation in case it helps and you're still
reading ;-)

What was initially envisioned as a fairly typical Rails application with
a heavy dose of RJS has grown into a soon-to-be RESTful (or soon will
be) Rails web service that talks to two Ajax clients, one a single-page
and the other a multipage app, and two self-spawned HTTP clients.  Each
of the clients is pretty-well constrained in terms of the resources /
methods it needs.

I'm thinking of moving the Ajax clients to using an MVP pattern and
keeping the HTTP clients on the standard Rails MVC pattern.  My thought
is that if each client is restricted to one 'channel' (HTML | JS | XML)
then I'll not only get better structure / testability on the code
serving the Ajax clients, from a security perspective, I can lock down
resources by URL, HTTP verb, and protocol.

Any thoughts / discussion is much appreciated.

Best regards,
Bill
171ea139761951336b844e708d1547ab?d=identicon&s=25 James Byrne (byrnejb)
on 2009-03-30 03:59
bill walton wrote:

>
> Any thoughts / discussion is much appreciated.

The original concept of controllers in MVC was that they handled
terminal events like mouse and keystrokes. The elaboration of MVC into
MVP moved that responsibility into another layer between views and
controllers called a presenter.  One could argue that what one really
has with Rails 2.x is MVP, with the browser acting as the presenter,
rather than MVC.
91a72b0ad3e43e3ef3a31816667ec694?d=identicon&s=25 bill walton (Guest)
on 2009-03-31 02:34
(Received via mailing list)
Hi James,

Thanks much for the reply!

On Mon, 2009-03-30 at 03:59 +0200, James Byrne wrote:
> bill walton wrote:
>
> >
> > Any thoughts / discussion is much appreciated.
>
> The original concept of controllers in MVC was that they handled
> terminal events like mouse and keystrokes. The elaboration of MVC into
> MVP moved that responsibility into another layer between views and
> controllers called a presenter.

Interesting.  My understanding / impression is that the presenter sits
between a controller and a set of models.


> One could argue that what one really
> has with Rails 2.x is MVP, with the browser acting as the presenter,
> rather than MVC.

Don't think I understand this perspective.  Say more, plz.  My
understanding is that one 'purpose' of the Presenter pattern is to
restore the 'silo-like' source code organization that MVC brings to the
table.  With MVC, if I need to modify the customer info section of an
app, I know I'll be looking at customers_controller.rb, .rhtml files in
the  views/customers folder, and the customer.rb file in the models
folder.

Best regards,
Bill
This topic is locked and can not be replied to.