Basically, there are two options that I know.
The first is to view event notifications for which the subscriber should be subscribed. When a user clicks on a button on a view, the view simply triggers an event, notifies that something has changed.
Secondly, just use the observer pattern and let the facilitator intervene in some kind of contract. Let it be an interface with methods such as the events that I mentioned above. An observer lead should be added to the view.
As Jeremy Miller said in his legendary “Create Your Own CAB Series” on blogs , it’s best to use the second option.
What is your opinion on this topic? How do you connect a presenter and view your projects? What are the advantages or disadvantages for each option?
Let me do the survey here. I think that would be helpful. Thanks in advance!
To answer Peter Richie's answer.
My problem is that my inexperience and I must rely on the opinion of someone to make a decision and choose a method that seems right to me.
The disadvantage of interfaces is that you have a certain connection. The view is associated with an interface, and something must implement this interface
But, on the other hand, do events not work as some kind of contract (for example, an interface)? He tied the speaker to an opinion, since he must respond to these events.
source
share