There is some kind of misunderstanding about the presenter pattern in the rails community. It seems, two different patterns are hidden under the same name.
Overwhelming majority of blog posts about "rails and presenter pattern" treats the pattern as some sort of the facade pattern (http://blog.jayfields.com/2007/03/rails-presenter-pattern.html, http://kpumuk.info/ruby-on-rails/simplifying-your-ruby-on-rails-code/, http://donttrustthisguy.com/2008/05/29/using-presenters-in-rails-3/). This facade wraps a domain object or a set of domain objects. A presenter object doesn't aware about other application layers. In particular, it doesn't contain references to views.
In the other hand there is an alternative interpretation of the presenter pattern. According to Martin Fowler's description, it looks more like a controller, or consist of a controller and other components (see original pages for more details).
Thereby two distinct concepts were messed up. And confusion is increased by the fact that the authors of these ruby blogs refer to Martin Fowler's bliki :)
No comments:
Post a Comment