On Tue, Oct 21, 2008 at 3:57 PM, Rahoul Baruah <[EMAIL PROTECTED]> wrote: > > * the presenter/service's role is to coordinate the models - so its specs > are purely about mocking the associations and the calls inbetween them > * the presenter/service isn't a model (not ActiveRecord::Base) - so it's not > adding extra responsibilities to the models > * it is pretty much a service layer sat between controllers and models
There seems to be some overload on the word "Presenter" in Railsspeak. As best I can tell, people are using it to refer to two or more totally different patterns. Initially I thought presenters were for encapsulating limited-domain *controller and view logic* in such a way that they could be embedded in other controllers, thus allowing composition in views. Things like sidebar widgets, or components of a dashboard, or a reusable address box, etc. Stuff that benefits from maintaining its own data so you can't just a partial, but it's still more about the view than the model. On Googling this post, however, I've found that some people do use it that way, but other people talk about the Presenter pattern as a class to aggregate data before sending it to (or split data after receiving it from) the controller. I.e., what you're saying. I think Jay Fields confused the issue by talking about presenters in this way, but saying you're doing it for the sake of the *view.* All of this has convinced me that the name "Presenter" sucks and nobody should use it. My thinking this is unlikely to change anything, but at least people ought to agree on what they are. What you're talking about, Rahoul, at least one or two people are calling a "Conductor": http://blog.new-bamboo.co.uk/2007/8/31/presenters-conductors-on-rails Personally I prefer handling it in the model, and letting models act as compositions of other models if need be, but that's just me. -- Have Fun, Steve Eley ([EMAIL PROTECTED]) ESCAPE POD - The Science Fiction Podcast Magazine http://www.escapepod.org _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users