New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Presenter Pattern #216
Comments
For something to be a pattern according to Wikipedia it has to be "strictly described and commonly available". But even these few links you shared don't have the strict and common description of the Presenter. This is because the Presenter is a just one of the components of the MVP architecture which only defines the communication flow between its three key components and their responsibilities. There is no concrete implementation of the Presenter or its interface because it can be done in many different ways. In case, maintainers want to add architectural patterns to this repository it has to be an example of the whole MVP approach. But it's a very tricky task which requires writing much more code than for design patterns and writing a pretty good explanation of key differences and benefits comparing with other MVC family patterns. Btw there is an interesting reading on this topic from Martin Fowler http://martinfowler.com/eaaDev/ModelViewPresenter.html |
I think I wrote too much above, which created more than enough space for arguing. To make it shorter and simpler, the idea of adding Presenter pattern is the same as the idea of adding separate Model or View patterns. |
You are correct, there seems to be multiple implementations to this pattern that differ depending on the use-case(framework/language/etc..). Also the MVC/MVP patterns are probably too big to be discussed within a repo such as this. At that point, looking at frameworks would be a good start. Ill keep the issue open, as the MVP pattern is something worth thinking about. Ill have to give this more thought. Thanks @ihor! |
Rule of thumb: when in doubt, check with Martin Fowler :) |
Following that link you gave me, it seems there is an example of a presenter model http://martinfowler.com/eaaDev/PresentationModel.html "The essence of a Presentation Model is of a fully self-contained class that represents all the data and behavior of the UI window, but without any of the controls used to render that UI on the screen. A view then simply projects the state of the presentation model onto the glass." Although the point still stands that a presenter has no context without its corresponding dependent models and view. Hopefully, I am not confusing the Presenter Model with just a plain old Model. |
It's a different thing but it helps to achieve one of the benefits which MVP provides, which is decoupling the view and the model. |
Closing this issue until a more definite presenter pattern can be ascertained. |
How do you feel about adding the Presenter Pattern to this repo? Its similar to the Decorator pattern, but has some key differences. Decorators add new functionality to class instances, whereas Presenters are closer to the view and work directly with the view layer and may contain the language of the view (html/css/etc..). It also contains the ui business logic for the View.
Example code:
Some references:
https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93presenter
http://stackoverflow.com/questions/2056/what-are-mvp-and-mvc-and-what-is-the-difference
https://github.com/laracasts/Presenter
Thoughts as this might be closer to the singleton pattern (might be an anti-pattern)?
The text was updated successfully, but these errors were encountered: