I used to have connections with my presenters, but they moved away from this. It does not correspond to the initial definition of the template (not in itself the reason for the deviation of only a factor contributing to the determination of these advantages). Ideas should ideally be as stupid and with as few dependencies as possible. View should report w / Presenter (any "observers") through delegates / events / some mechanism of "fire and swelling". In fact, I introduced the controller in MVP specifically for intercepting Event viewing and restarting for the presenter (rarely) to communicate with the presenter or to communicate with the system or a special event bus, allowing me to change the mechanisms for preventing user actions without touching the view. However, be careful with the event bus; pretty soon, you start throwing all the events there, the application becomes chatty / bogged down in event processing, and events are not the fastest things in .Net. Sunchronization is an additional problem, esp, if ur application should have more “interactive” interaction with your user.
Keep in mind that although Presenter is a view of the view / process, view (and view models) can be reused; having a representation in a containment / delegation relationship with a presenter is a strong pair. View / restrict its reuse. This can be reduced with some DI, but in most cases I find that DI containers are not unnecessarily complex (since I need to know how to create objects anyway and how often you change an object for another semantically similar after creating / testing it ?). A specific dependency goes nowhere except at a different level / adds more ambiguity / makes debugging / tracing more difficult. Recently, "simplicity" has been used, and in most cases I prefer to do my Factory work / object creation / ORM mappings for most applications, since there is a 1-to-1 btw db table / entity and n is needed for added complexity of a third-party ORM universal tool, which due to the universal context / service needs of various applications should make everything more difficult than they need, even if you understand how they work (not so).
In addition, it is still possible that View will observe the model in MVP (as in MVC), so I would not do it so quickly. I do not prefer to do this myself, but it does not “break” the template. In fact, I developed something similar to MVP about ten years ago, because I did not like the “circular loop” between the components of MVC (View know about Model); I preferred to have a cleaner separation of btw View and Model that all of these templates claimed (including MVC), as well as the desire to keep the View as stupid as possible (watching Model would mean that the View would need more intelligence to handle model changes ) What I ended up with was something like MVVM and the patter strategy, where I used the “substructures” of the model to go to the view, acting as “change notifications”. It all came down to specific goals and flexible / reusable (hard combos).
user1172173
source share